{"cells":[{"cell_type":"markdown","metadata":{"id":"rJq0P-XPZjEr"},"source":["## Импорты"]},{"cell_type":"markdown","metadata":{"id":"eCQN8jjdagq9"},"source":[]},{"cell_type":"code","execution_count":null,"metadata":{"id":"yT-3H1-EYgQq"},"outputs":[],"source":["# Библиотека для работы с табличными данными\n","import pandas as pd"]},{"cell_type":"markdown","metadata":{"id":"k4RyroTloZz0"},"source":["![image.png]()"]},{"cell_type":"markdown","metadata":{"id":"PViXfvQTeU-f"},"source":["# Чтение и предварительный просмотр данных"]},{"cell_type":"markdown","metadata":{"id":"b1oKxTdReZa8"},"source":["Библиотека **pandas** может читать многие форматы, включая: **.csv, .xslx, .xls, .txt, sql** и многие другие.\n","\n","Полный список по [ссылке](https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html)"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"-e37LxEUYyuF"},"outputs":[],"source":["# Прочтем файл .csv с помощью библиотеки pandas\n","# df = pd.read_csv('sample_data/california_housing_train.csv')\n","df = pd.read_csv(\"california_housing_train.csv.zip\")"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":3,"status":"ok","timestamp":1708971872905,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"TH49_JJvqO2Y","outputId":"2de90b40-ac78-4398-ef17-9837aa8ff6c9"},"outputs":[{"data":{"text/plain":["(17000, 9)"]},"execution_count":6,"metadata":{},"output_type":"execute_result"}],"source":["df.shape"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":2,"status":"ok","timestamp":1708971876332,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"dZyco3XtqPaW","outputId":"31a2c26e-85fe-4461-8953-d2ac2e3486d7"},"outputs":[{"data":{"text/plain":["(3000, 9)"]},"execution_count":8,"metadata":{},"output_type":"execute_result"}],"source":[]},{"cell_type":"markdown","metadata":{"id":"WJeaKaEhc-Kf"},"source":[]},{"cell_type":"markdown","metadata":{"id":"dqNL_danc3w_"},"source":["\n","```\n","DataFrame.head(n=5)\n","Параметры:\n","n: int, значение по умолчанию 5\n","```\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":269},"executionInfo":{"elapsed":276,"status":"ok","timestamp":1708971431329,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"hKyoqeTmZJDx","outputId":"2f526767-d47f-4f58-d359-6afeb9417160"},"outputs":[{"data":{"application/vnd.google.colaboratory.intrinsic+json":{"summary":"{\n  \"name\": \"df\",\n  \"rows\": 17000,\n  \"fields\": [\n    {\n      \"column\": \"longitude\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 2.0051664084261778,\n        \"min\": -124.35,\n        \"max\": -114.31,\n        \"num_unique_values\": 827,\n        \"samples\": [\n          -117.56,\n          -123.32,\n          -118.26\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"latitude\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 2.1373397946570836,\n        \"min\": 32.54,\n        \"max\": 41.95,\n        \"num_unique_values\": 840,\n        \"samples\": [\n          38.44,\n          40.79,\n          32.69\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"housing_median_age\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 12.586936981660399,\n        \"min\": 1.0,\n        \"max\": 52.0,\n        \"num_unique_values\": 52,\n        \"samples\": [\n          23.0,\n          52.0,\n          47.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"total_rooms\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 2179.947071452767,\n        \"min\": 2.0,\n        \"max\": 37937.0,\n        \"num_unique_values\": 5533,\n        \"samples\": [\n          3564.0,\n          6955.0,\n          5451.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"total_bedrooms\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 421.4994515798646,\n        \"min\": 1.0,\n        \"max\": 6445.0,\n        \"num_unique_values\": 1848,\n        \"samples\": [\n          729.0,\n          719.0,\n          2075.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"population\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 1147.8529591595266,\n        \"min\": 3.0,\n        \"max\": 35682.0,\n        \"num_unique_values\": 3683,\n        \"samples\": [\n          249.0,\n          1735.0,\n          235.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"households\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 384.5208408559009,\n        \"min\": 1.0,\n        \"max\": 6082.0,\n        \"num_unique_values\": 1740,\n        \"samples\": [\n          390.0,\n          1089.0,\n          1351.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"median_income\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 1.9081565183791036,\n        \"min\": 0.4999,\n        \"max\": 15.0001,\n        \"num_unique_values\": 11175,\n        \"samples\": [\n          7.2655,\n          5.6293,\n          4.2262\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"median_house_value\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 115983.76438720885,\n        \"min\": 14999.0,\n        \"max\": 500001.0,\n        \"num_unique_values\": 3694,\n        \"samples\": [\n          162300.0,\n          346800.0,\n          116700.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}","type":"dataframe","variable_name":"df"},"text/html":["\n","  <div id=\"df-3d15ff7e-73b6-46b1-bbd4-8e22755f0272\" class=\"colab-df-container\">\n","    <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>longitude</th>\n","      <th>latitude</th>\n","      <th>housing_median_age</th>\n","      <th>total_rooms</th>\n","      <th>total_bedrooms</th>\n","      <th>population</th>\n","      <th>households</th>\n","      <th>median_income</th>\n","      <th>median_house_value</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>-114.31</td>\n","      <td>34.19</td>\n","      <td>15.0</td>\n","      <td>5612.0</td>\n","      <td>1283.0</td>\n","      <td>1015.0</td>\n","      <td>472.0</td>\n","      <td>1.4936</td>\n","      <td>66900.0</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>-114.47</td>\n","      <td>34.40</td>\n","      <td>19.0</td>\n","      <td>7650.0</td>\n","      <td>1901.0</td>\n","      <td>1129.0</td>\n","      <td>463.0</td>\n","      <td>1.8200</td>\n","      <td>80100.0</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>-114.56</td>\n","      <td>33.69</td>\n","      <td>17.0</td>\n","      <td>720.0</td>\n","      <td>174.0</td>\n","      <td>333.0</td>\n","      <td>117.0</td>\n","      <td>1.6509</td>\n","      <td>85700.0</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>-114.57</td>\n","      <td>33.64</td>\n","      <td>14.0</td>\n","      <td>1501.0</td>\n","      <td>337.0</td>\n","      <td>515.0</td>\n","      <td>226.0</td>\n","      <td>3.1917</td>\n","      <td>73400.0</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>-114.57</td>\n","      <td>33.57</td>\n","      <td>20.0</td>\n","      <td>1454.0</td>\n","      <td>326.0</td>\n","      <td>624.0</td>\n","      <td>262.0</td>\n","      <td>1.9250</td>\n","      <td>65500.0</td>\n","    </tr>\n","    <tr>\n","      <th>5</th>\n","      <td>-114.58</td>\n","      <td>33.63</td>\n","      <td>29.0</td>\n","      <td>1387.0</td>\n","      <td>236.0</td>\n","      <td>671.0</td>\n","      <td>239.0</td>\n","      <td>3.3438</td>\n","      <td>74000.0</td>\n","    </tr>\n","    <tr>\n","      <th>6</th>\n","      <td>-114.58</td>\n","      <td>33.61</td>\n","      <td>25.0</td>\n","      <td>2907.0</td>\n","      <td>680.0</td>\n","      <td>1841.0</td>\n","      <td>633.0</td>\n","      <td>2.6768</td>\n","      <td>82400.0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","    <div class=\"colab-df-buttons\">\n","\n","  <div class=\"colab-df-container\">\n","    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-3d15ff7e-73b6-46b1-bbd4-8e22755f0272')\"\n","            title=\"Convert this dataframe to an interactive table.\"\n","            style=\"display:none;\">\n","\n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n","    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n","  </svg>\n","    </button>\n","\n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    .colab-df-buttons div {\n","      margin-bottom: 4px;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","    <script>\n","      const buttonEl =\n","        document.querySelector('#df-3d15ff7e-73b6-46b1-bbd4-8e22755f0272 button.colab-df-convert');\n","      buttonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","      async function convertToInteractive(key) {\n","        const element = document.querySelector('#df-3d15ff7e-73b6-46b1-bbd4-8e22755f0272');\n","        const dataTable =\n","          await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                    [key], {});\n","        if (!dataTable) return;\n","\n","        const docLinkHtml = 'Like what you see? Visit the ' +\n","          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","          + ' to learn more about interactive tables.';\n","        element.innerHTML = '';\n","        dataTable['output_type'] = 'display_data';\n","        await google.colab.output.renderOutput(dataTable, element);\n","        const docLink = document.createElement('div');\n","        docLink.innerHTML = docLinkHtml;\n","        element.appendChild(docLink);\n","      }\n","    </script>\n","  </div>\n","\n","\n","<div id=\"df-3e21b6ba-39a7-49d7-a57a-2afed3b94208\">\n","  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-3e21b6ba-39a7-49d7-a57a-2afed3b94208')\"\n","            title=\"Suggest charts\"\n","            style=\"display:none;\">\n","\n","<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","     width=\"24px\">\n","    <g>\n","        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n","    </g>\n","</svg>\n","  </button>\n","\n","<style>\n","  .colab-df-quickchart {\n","      --bg-color: #E8F0FE;\n","      --fill-color: #1967D2;\n","      --hover-bg-color: #E2EBFA;\n","      --hover-fill-color: #174EA6;\n","      --disabled-fill-color: #AAA;\n","      --disabled-bg-color: #DDD;\n","  }\n","\n","  [theme=dark] .colab-df-quickchart {\n","      --bg-color: #3B4455;\n","      --fill-color: #D2E3FC;\n","      --hover-bg-color: #434B5C;\n","      --hover-fill-color: #FFFFFF;\n","      --disabled-bg-color: #3B4455;\n","      --disabled-fill-color: #666;\n","  }\n","\n","  .colab-df-quickchart {\n","    background-color: var(--bg-color);\n","    border: none;\n","    border-radius: 50%;\n","    cursor: pointer;\n","    display: none;\n","    fill: var(--fill-color);\n","    height: 32px;\n","    padding: 0;\n","    width: 32px;\n","  }\n","\n","  .colab-df-quickchart:hover {\n","    background-color: var(--hover-bg-color);\n","    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n","    fill: var(--button-hover-fill-color);\n","  }\n","\n","  .colab-df-quickchart-complete:disabled,\n","  .colab-df-quickchart-complete:disabled:hover {\n","    background-color: var(--disabled-bg-color);\n","    fill: var(--disabled-fill-color);\n","    box-shadow: none;\n","  }\n","\n","  .colab-df-spinner {\n","    border: 2px solid var(--fill-color);\n","    border-color: transparent;\n","    border-bottom-color: var(--fill-color);\n","    animation:\n","      spin 1s steps(1) infinite;\n","  }\n","\n","  @keyframes spin {\n","    0% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","      border-left-color: var(--fill-color);\n","    }\n","    20% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    30% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","      border-right-color: var(--fill-color);\n","    }\n","    40% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    60% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","    }\n","    80% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-bottom-color: var(--fill-color);\n","    }\n","    90% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","    }\n","  }\n","</style>\n","\n","  <script>\n","    async function quickchart(key) {\n","      const quickchartButtonEl =\n","        document.querySelector('#' + key + ' button');\n","      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n","      quickchartButtonEl.classList.add('colab-df-spinner');\n","      try {\n","        const charts = await google.colab.kernel.invokeFunction(\n","            'suggestCharts', [key], {});\n","      } catch (error) {\n","        console.error('Error during call to suggestCharts:', error);\n","      }\n","      quickchartButtonEl.classList.remove('colab-df-spinner');\n","      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n","    }\n","    (() => {\n","      let quickchartButtonEl =\n","        document.querySelector('#df-3e21b6ba-39a7-49d7-a57a-2afed3b94208 button');\n","      quickchartButtonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","    })();\n","  </script>\n","</div>\n","    </div>\n","  </div>\n"],"text/plain":["   longitude  latitude  housing_median_age  total_rooms  total_bedrooms  \\\n","0    -114.31     34.19                15.0       5612.0          1283.0   \n","1    -114.47     34.40                19.0       7650.0          1901.0   \n","2    -114.56     33.69                17.0        720.0           174.0   \n","3    -114.57     33.64                14.0       1501.0           337.0   \n","4    -114.57     33.57                20.0       1454.0           326.0   \n","5    -114.58     33.63                29.0       1387.0           236.0   \n","6    -114.58     33.61                25.0       2907.0           680.0   \n","\n","   population  households  median_income  median_house_value  \n","0      1015.0       472.0         1.4936             66900.0  \n","1      1129.0       463.0         1.8200             80100.0  \n","2       333.0       117.0         1.6509             85700.0  \n","3       515.0       226.0         3.1917             73400.0  \n","4       624.0       262.0         1.9250             65500.0  \n","5       671.0       239.0         3.3438             74000.0  \n","6      1841.0       633.0         2.6768             82400.0  "]},"execution_count":5,"metadata":{},"output_type":"execute_result"}],"source":["# Посмотреть первые 5 строк\n","df.head(7)"]},{"cell_type":"markdown","metadata":{"id":"z4vZfyaOdL1F"},"source":["\n","\n","```\n","DataFrame.tail(n=5)\n","Параметры:\n","n: int, значение по умолчнию 5\n","```\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":520},"executionInfo":{"elapsed":302,"status":"ok","timestamp":1708933110475,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"4w1GEyEdaYBJ","outputId":"e9649d80-8b7c-4bf3-c540-ffbee23d3b45"},"outputs":[{"data":{"application/vnd.google.colaboratory.intrinsic+json":{"summary":"{\n  \"name\": \"df\",\n  \"rows\": 15,\n  \"fields\": [\n    {\n      \"column\": \"longitude\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 0.045460605656619184,\n        \"min\": -124.35,\n        \"max\": -124.19,\n        \"num_unique_values\": 9,\n        \"samples\": [\n          -124.3,\n          -124.21,\n          -124.26\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"latitude\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 0.5926317414317099,\n        \"min\": 40.28,\n        \"max\": 41.84,\n        \"num_unique_values\": 13,\n        \"samples\": [\n          41.84,\n          40.58,\n          40.77\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"housing_median_age\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 14.529772390312441,\n        \"min\": 11.0,\n        \"max\": 52.0,\n        \"num_unique_values\": 10,\n        \"samples\": [\n          36.0,\n          21.0,\n          28.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"total_rooms\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 1153.0601190290288,\n        \"min\": 1112.0,\n        \"max\": 5694.0,\n        \"num_unique_values\": 15,\n        \"samples\": [\n          1430.0,\n          2349.0,\n          2975.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"total_bedrooms\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 216.1142114275514,\n        \"min\": 209.0,\n        \"max\": 1056.0,\n        \"num_unique_values\": 15,\n        \"samples\": [\n          419.0,\n          528.0,\n          634.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"population\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 641.2125195581377,\n        \"min\": 434.0,\n        \"max\": 2907.0,\n        \"num_unique_values\": 15,\n        \"samples\": [\n          434.0,\n          1194.0,\n          1367.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"households\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 216.02678405367107,\n        \"min\": 172.0,\n        \"max\": 972.0,\n        \"num_unique_values\": 15,\n        \"samples\": [\n          187.0,\n          465.0,\n          583.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"median_income\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 0.590390717680935,\n        \"min\": 1.6528,\n        \"max\": 3.5363,\n        \"num_unique_values\": 15,\n        \"samples\": [\n          1.9417,\n          2.5179,\n          2.442\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"median_house_value\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 17767.90847085192,\n        \"min\": 50800.0,\n        \"max\": 111400.0,\n        \"num_unique_values\": 15,\n        \"samples\": [\n          76100.0,\n          79000.0,\n          69000.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}","type":"dataframe"},"text/html":["\n","  <div id=\"df-c3ca9081-c9f0-4e02-b62c-0baf59d37825\" class=\"colab-df-container\">\n","    <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>longitude</th>\n","      <th>latitude</th>\n","      <th>housing_median_age</th>\n","      <th>total_rooms</th>\n","      <th>total_bedrooms</th>\n","      <th>population</th>\n","      <th>households</th>\n","      <th>median_income</th>\n","      <th>median_house_value</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>16985</th>\n","      <td>-124.19</td>\n","      <td>40.77</td>\n","      <td>30.0</td>\n","      <td>2975.0</td>\n","      <td>634.0</td>\n","      <td>1367.0</td>\n","      <td>583.0</td>\n","      <td>2.4420</td>\n","      <td>69000.0</td>\n","    </tr>\n","    <tr>\n","      <th>16986</th>\n","      <td>-124.19</td>\n","      <td>40.73</td>\n","      <td>21.0</td>\n","      <td>5694.0</td>\n","      <td>1056.0</td>\n","      <td>2907.0</td>\n","      <td>972.0</td>\n","      <td>3.5363</td>\n","      <td>90100.0</td>\n","    </tr>\n","    <tr>\n","      <th>16987</th>\n","      <td>-124.21</td>\n","      <td>41.77</td>\n","      <td>17.0</td>\n","      <td>3461.0</td>\n","      <td>722.0</td>\n","      <td>1947.0</td>\n","      <td>647.0</td>\n","      <td>2.5795</td>\n","      <td>68400.0</td>\n","    </tr>\n","    <tr>\n","      <th>16988</th>\n","      <td>-124.21</td>\n","      <td>41.75</td>\n","      <td>20.0</td>\n","      <td>3810.0</td>\n","      <td>787.0</td>\n","      <td>1993.0</td>\n","      <td>721.0</td>\n","      <td>2.0074</td>\n","      <td>66900.0</td>\n","    </tr>\n","    <tr>\n","      <th>16989</th>\n","      <td>-124.21</td>\n","      <td>40.75</td>\n","      <td>32.0</td>\n","      <td>1218.0</td>\n","      <td>331.0</td>\n","      <td>620.0</td>\n","      <td>268.0</td>\n","      <td>1.6528</td>\n","      <td>58100.0</td>\n","    </tr>\n","    <tr>\n","      <th>16990</th>\n","      <td>-124.22</td>\n","      <td>41.73</td>\n","      <td>28.0</td>\n","      <td>3003.0</td>\n","      <td>699.0</td>\n","      <td>1530.0</td>\n","      <td>653.0</td>\n","      <td>1.7038</td>\n","      <td>78300.0</td>\n","    </tr>\n","    <tr>\n","      <th>16991</th>\n","      <td>-124.23</td>\n","      <td>41.75</td>\n","      <td>11.0</td>\n","      <td>3159.0</td>\n","      <td>616.0</td>\n","      <td>1343.0</td>\n","      <td>479.0</td>\n","      <td>2.4805</td>\n","      <td>73200.0</td>\n","    </tr>\n","    <tr>\n","      <th>16992</th>\n","      <td>-124.23</td>\n","      <td>40.81</td>\n","      <td>52.0</td>\n","      <td>1112.0</td>\n","      <td>209.0</td>\n","      <td>544.0</td>\n","      <td>172.0</td>\n","      <td>3.3462</td>\n","      <td>50800.0</td>\n","    </tr>\n","    <tr>\n","      <th>16993</th>\n","      <td>-124.23</td>\n","      <td>40.54</td>\n","      <td>52.0</td>\n","      <td>2694.0</td>\n","      <td>453.0</td>\n","      <td>1152.0</td>\n","      <td>435.0</td>\n","      <td>3.0806</td>\n","      <td>106700.0</td>\n","    </tr>\n","    <tr>\n","      <th>16994</th>\n","      <td>-124.25</td>\n","      <td>40.28</td>\n","      <td>32.0</td>\n","      <td>1430.0</td>\n","      <td>419.0</td>\n","      <td>434.0</td>\n","      <td>187.0</td>\n","      <td>1.9417</td>\n","      <td>76100.0</td>\n","    </tr>\n","    <tr>\n","      <th>16995</th>\n","      <td>-124.26</td>\n","      <td>40.58</td>\n","      <td>52.0</td>\n","      <td>2217.0</td>\n","      <td>394.0</td>\n","      <td>907.0</td>\n","      <td>369.0</td>\n","      <td>2.3571</td>\n","      <td>111400.0</td>\n","    </tr>\n","    <tr>\n","      <th>16996</th>\n","      <td>-124.27</td>\n","      <td>40.69</td>\n","      <td>36.0</td>\n","      <td>2349.0</td>\n","      <td>528.0</td>\n","      <td>1194.0</td>\n","      <td>465.0</td>\n","      <td>2.5179</td>\n","      <td>79000.0</td>\n","    </tr>\n","    <tr>\n","      <th>16997</th>\n","      <td>-124.30</td>\n","      <td>41.84</td>\n","      <td>17.0</td>\n","      <td>2677.0</td>\n","      <td>531.0</td>\n","      <td>1244.0</td>\n","      <td>456.0</td>\n","      <td>3.0313</td>\n","      <td>103600.0</td>\n","    </tr>\n","    <tr>\n","      <th>16998</th>\n","      <td>-124.30</td>\n","      <td>41.80</td>\n","      <td>19.0</td>\n","      <td>2672.0</td>\n","      <td>552.0</td>\n","      <td>1298.0</td>\n","      <td>478.0</td>\n","      <td>1.9797</td>\n","      <td>85800.0</td>\n","    </tr>\n","    <tr>\n","      <th>16999</th>\n","      <td>-124.35</td>\n","      <td>40.54</td>\n","      <td>52.0</td>\n","      <td>1820.0</td>\n","      <td>300.0</td>\n","      <td>806.0</td>\n","      <td>270.0</td>\n","      <td>3.0147</td>\n","      <td>94600.0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","    <div class=\"colab-df-buttons\">\n","\n","  <div class=\"colab-df-container\">\n","    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-c3ca9081-c9f0-4e02-b62c-0baf59d37825')\"\n","            title=\"Convert this dataframe to an interactive table.\"\n","            style=\"display:none;\">\n","\n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n","    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n","  </svg>\n","    </button>\n","\n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    .colab-df-buttons div {\n","      margin-bottom: 4px;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","    <script>\n","      const buttonEl =\n","        document.querySelector('#df-c3ca9081-c9f0-4e02-b62c-0baf59d37825 button.colab-df-convert');\n","      buttonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","      async function convertToInteractive(key) {\n","        const element = document.querySelector('#df-c3ca9081-c9f0-4e02-b62c-0baf59d37825');\n","        const dataTable =\n","          await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                    [key], {});\n","        if (!dataTable) return;\n","\n","        const docLinkHtml = 'Like what you see? Visit the ' +\n","          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","          + ' to learn more about interactive tables.';\n","        element.innerHTML = '';\n","        dataTable['output_type'] = 'display_data';\n","        await google.colab.output.renderOutput(dataTable, element);\n","        const docLink = document.createElement('div');\n","        docLink.innerHTML = docLinkHtml;\n","        element.appendChild(docLink);\n","      }\n","    </script>\n","  </div>\n","\n","\n","<div id=\"df-63366d38-24c5-4956-b19d-b867f452333b\">\n","  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-63366d38-24c5-4956-b19d-b867f452333b')\"\n","            title=\"Suggest charts\"\n","            style=\"display:none;\">\n","\n","<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","     width=\"24px\">\n","    <g>\n","        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n","    </g>\n","</svg>\n","  </button>\n","\n","<style>\n","  .colab-df-quickchart {\n","      --bg-color: #E8F0FE;\n","      --fill-color: #1967D2;\n","      --hover-bg-color: #E2EBFA;\n","      --hover-fill-color: #174EA6;\n","      --disabled-fill-color: #AAA;\n","      --disabled-bg-color: #DDD;\n","  }\n","\n","  [theme=dark] .colab-df-quickchart {\n","      --bg-color: #3B4455;\n","      --fill-color: #D2E3FC;\n","      --hover-bg-color: #434B5C;\n","      --hover-fill-color: #FFFFFF;\n","      --disabled-bg-color: #3B4455;\n","      --disabled-fill-color: #666;\n","  }\n","\n","  .colab-df-quickchart {\n","    background-color: var(--bg-color);\n","    border: none;\n","    border-radius: 50%;\n","    cursor: pointer;\n","    display: none;\n","    fill: var(--fill-color);\n","    height: 32px;\n","    padding: 0;\n","    width: 32px;\n","  }\n","\n","  .colab-df-quickchart:hover {\n","    background-color: var(--hover-bg-color);\n","    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n","    fill: var(--button-hover-fill-color);\n","  }\n","\n","  .colab-df-quickchart-complete:disabled,\n","  .colab-df-quickchart-complete:disabled:hover {\n","    background-color: var(--disabled-bg-color);\n","    fill: var(--disabled-fill-color);\n","    box-shadow: none;\n","  }\n","\n","  .colab-df-spinner {\n","    border: 2px solid var(--fill-color);\n","    border-color: transparent;\n","    border-bottom-color: var(--fill-color);\n","    animation:\n","      spin 1s steps(1) infinite;\n","  }\n","\n","  @keyframes spin {\n","    0% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","      border-left-color: var(--fill-color);\n","    }\n","    20% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    30% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","      border-right-color: var(--fill-color);\n","    }\n","    40% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    60% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","    }\n","    80% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-bottom-color: var(--fill-color);\n","    }\n","    90% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","    }\n","  }\n","</style>\n","\n","  <script>\n","    async function quickchart(key) {\n","      const quickchartButtonEl =\n","        document.querySelector('#' + key + ' button');\n","      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n","      quickchartButtonEl.classList.add('colab-df-spinner');\n","      try {\n","        const charts = await google.colab.kernel.invokeFunction(\n","            'suggestCharts', [key], {});\n","      } catch (error) {\n","        console.error('Error during call to suggestCharts:', error);\n","      }\n","      quickchartButtonEl.classList.remove('colab-df-spinner');\n","      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n","    }\n","    (() => {\n","      let quickchartButtonEl =\n","        document.querySelector('#df-63366d38-24c5-4956-b19d-b867f452333b button');\n","      quickchartButtonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","    })();\n","  </script>\n","</div>\n","    </div>\n","  </div>\n"],"text/plain":["       longitude  latitude  housing_median_age  total_rooms  total_bedrooms  \\\n","16985    -124.19     40.77                30.0       2975.0           634.0   \n","16986    -124.19     40.73                21.0       5694.0          1056.0   \n","16987    -124.21     41.77                17.0       3461.0           722.0   \n","16988    -124.21     41.75                20.0       3810.0           787.0   \n","16989    -124.21     40.75                32.0       1218.0           331.0   \n","16990    -124.22     41.73                28.0       3003.0           699.0   \n","16991    -124.23     41.75                11.0       3159.0           616.0   \n","16992    -124.23     40.81                52.0       1112.0           209.0   \n","16993    -124.23     40.54                52.0       2694.0           453.0   \n","16994    -124.25     40.28                32.0       1430.0           419.0   \n","16995    -124.26     40.58                52.0       2217.0           394.0   \n","16996    -124.27     40.69                36.0       2349.0           528.0   \n","16997    -124.30     41.84                17.0       2677.0           531.0   \n","16998    -124.30     41.80                19.0       2672.0           552.0   \n","16999    -124.35     40.54                52.0       1820.0           300.0   \n","\n","       population  households  median_income  median_house_value  \n","16985      1367.0       583.0         2.4420             69000.0  \n","16986      2907.0       972.0         3.5363             90100.0  \n","16987      1947.0       647.0         2.5795             68400.0  \n","16988      1993.0       721.0         2.0074             66900.0  \n","16989       620.0       268.0         1.6528             58100.0  \n","16990      1530.0       653.0         1.7038             78300.0  \n","16991      1343.0       479.0         2.4805             73200.0  \n","16992       544.0       172.0         3.3462             50800.0  \n","16993      1152.0       435.0         3.0806            106700.0  \n","16994       434.0       187.0         1.9417             76100.0  \n","16995       907.0       369.0         2.3571            111400.0  \n","16996      1194.0       465.0         2.5179             79000.0  \n","16997      1244.0       456.0         3.0313            103600.0  \n","16998      1298.0       478.0         1.9797             85800.0  \n","16999       806.0       270.0         3.0147             94600.0  "]},"execution_count":6,"metadata":{},"output_type":"execute_result"}],"source":["# Посмотреть последние 5 строк\n","df.tail(15)"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"umkBzt2xahSz","outputId":"a4fe3ae9-e1fe-481b-e76f-f22bb45f5d2a"},"outputs":[{"data":{"text/plain":["(17000, 9)"]},"execution_count":8,"metadata":{},"output_type":"execute_result"}],"source":["# Возвращает размеры таблицы: кортеж из 2 значений, 1 кол-во строк, 2 - кол-во столбцов\n","df.shape"]},{"cell_type":"markdown","metadata":{"id":"ED6ZQk0kdnZZ"},"source":["\n","\n","```\n","DataFrame.isnull() - обнаруживает пустые значения\n","DataFrame.sum(axis=None, skipna=None, level=None, numeric_only=None, min_count=0, **kwargs) - возвращает сумму значений по выбраной оси\n","Параметры:\n","axis: int {index (0), columns (1)} - ось(0 - вертикальная, 1 - горизонтальная)\n","По умолчанию 0\n","```\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"OrB4yQY7akUh","outputId":"e117c1af-0c8d-4ea8-b6c3-1f6cf01ad5f4"},"outputs":[{"data":{"text/plain":["longitude             0\n","latitude              0\n","housing_median_age    0\n","total_rooms           0\n","total_bedrooms        0\n","population            0\n","households            0\n","median_income         0\n","median_house_value    0\n","dtype: int64"]},"execution_count":9,"metadata":{},"output_type":"execute_result"}],"source":["# Посмотреть есть ли у нас пустые значения\n","# В данном случае пустых значений нет\n","df.isnull().sum()"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"wLwOwLdSa2f6","outputId":"eaeaf5bc-8a32-494e-ea44-392eabeea272"},"outputs":[{"data":{"text/plain":["longitude             float64\n","latitude              float64\n","housing_median_age    float64\n","total_rooms           float64\n","total_bedrooms        float64\n","population            float64\n","households            float64\n","median_income         float64\n","median_house_value    float64\n","dtype: object"]},"execution_count":10,"metadata":{},"output_type":"execute_result"}],"source":["# Проверить тип данных в столбцах\n","# В данных случаях везде float, число 64 указывает на разрядность(Используется 64 байта для хранения значения в памяти,\n","# чем меньше разрядность, тем меньший диапазон могут принимать числа и тем меньше тратится памяти на хранение.\n","df.dtypes"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"Ne32prWjbmgg","outputId":"3329e980-e310-4a6f-a82c-c4eb9f271d61"},"outputs":[{"data":{"text/plain":["Index(['longitude', 'latitude', 'housing_median_age', 'total_rooms',\n","       'total_bedrooms', 'population', 'households', 'median_income',\n","       'median_house_value'],\n","      dtype='object')"]},"execution_count":11,"metadata":{},"output_type":"execute_result"}],"source":["# Посмотреть все столбцы\n","# Возвращает список со строками строк - названиями столбцов в таблице\n","df.columns"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"H6DLeikXACrk"},"outputs":[],"source":[]},{"cell_type":"markdown","metadata":{"id":"Y7ZwxZffb-RF"},"source":["В данном случае у нас следующие строки:\n","\n","\n","1.   **longitude** - долгота\n","2.   **latitude** - широта\n","3.   **housing_median_age** - медианный возраст зданий\n","4.   **total_rooms** - общее кол-во зданий\n","5.   **total_bedrooms** - Общее кол-во спален\n","5.   **population** - кол-во жителей\n","5.   **households** - кол-во семей\n","5.   **median_house_value** - медианная стоимость дома\n","\n","\n"]},{"cell_type":"markdown","metadata":{"id":"rxwej4NLeqRJ"},"source":["**Медиана набора чисел** — число, которое находится в середине этого набора, если его упорядочить по возрастанию, то есть такое число, что половина из элементов набора не меньше него, а другая половина не больше."]},{"cell_type":"markdown","metadata":{"id":"d_eLxSfxdkDF"},"source":["# Самостоятельная практика №1\n","\n","\n","*   Прочесть с помощью pandas файл **california_housing_test.csv**, который находится в папке **sample_data**\n","*   Посмотреть сколько в нем строк и столбцов\n","*   (Доп) Определить какой тип данных имеют столбцы\n","*   (Доп) Проверить есть ли в файле пустые значения\n","\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"iHd88gdAb2gn"},"outputs":[],"source":[]},{"cell_type":"code","execution_count":null,"metadata":{"id":"3vJfyhje136C"},"outputs":[],"source":[]},{"cell_type":"code","execution_count":null,"metadata":{"id":"sQKyJHEqH9EI"},"outputs":[],"source":[]},{"cell_type":"code","execution_count":null,"metadata":{"id":"um1jvWM9Ite0"},"outputs":[],"source":[]},{"cell_type":"markdown","metadata":{"id":"NBLQcKE_ff2N"},"source":["# Выбор данных"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":316,"status":"ok","timestamp":1708933751203,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"7s1zjI_58OdD","outputId":"5bc48372-e666-4559-d1cb-8ef1a11e26a7"},"outputs":[{"data":{"text/plain":["0        34.19\n","1        34.40\n","2        33.69\n","3        33.64\n","4        33.57\n","         ...  \n","16995    40.58\n","16996    40.69\n","16997    41.84\n","16998    41.80\n","16999    40.54\n","Name: latitude, Length: 17000, dtype: float64"]},"execution_count":16,"metadata":{},"output_type":"execute_result"}],"source":["df[\"latitude\"]"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":424},"executionInfo":{"elapsed":295,"status":"ok","timestamp":1708972116503,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"tuzsq2X2fpyZ","outputId":"3f552606-dd95-40dc-a1ae-f97d8f95e292"},"outputs":[{"data":{"application/vnd.google.colaboratory.intrinsic+json":{"summary":"{\n  \"name\": \"df[['latitude', 'population']]\",\n  \"rows\": 3000,\n  \"fields\": [\n    {\n      \"column\": \"latitude\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 2.129669523343834,\n        \"min\": 32.56,\n        \"max\": 41.92,\n        \"num_unique_values\": 587,\n        \"samples\": [\n          40.17,\n          33.69,\n          39.61\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"population\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 1030.5430124122424,\n        \"min\": 5.0,\n        \"max\": 11935.0,\n        \"num_unique_values\": 1802,\n        \"samples\": [\n          947.0,\n          1140.0,\n          2019.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}","type":"dataframe"},"text/html":["\n","  <div id=\"df-bf3d925e-36d3-490d-a576-b06569740115\" class=\"colab-df-container\">\n","    <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>latitude</th>\n","      <th>population</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>37.37</td>\n","      <td>1537.0</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>34.26</td>\n","      <td>809.0</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>33.78</td>\n","      <td>1484.0</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>33.82</td>\n","      <td>49.0</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>36.33</td>\n","      <td>850.0</td>\n","    </tr>\n","    <tr>\n","      <th>...</th>\n","      <td>...</td>\n","      <td>...</td>\n","    </tr>\n","    <tr>\n","      <th>2995</th>\n","      <td>34.42</td>\n","      <td>1258.0</td>\n","    </tr>\n","    <tr>\n","      <th>2996</th>\n","      <td>34.06</td>\n","      <td>3496.0</td>\n","    </tr>\n","    <tr>\n","      <th>2997</th>\n","      <td>36.30</td>\n","      <td>693.0</td>\n","    </tr>\n","    <tr>\n","      <th>2998</th>\n","      <td>34.10</td>\n","      <td>46.0</td>\n","    </tr>\n","    <tr>\n","      <th>2999</th>\n","      <td>34.42</td>\n","      <td>753.0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>3000 rows × 2 columns</p>\n","</div>\n","    <div class=\"colab-df-buttons\">\n","\n","  <div class=\"colab-df-container\">\n","    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-bf3d925e-36d3-490d-a576-b06569740115')\"\n","            title=\"Convert this dataframe to an interactive table.\"\n","            style=\"display:none;\">\n","\n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n","    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n","  </svg>\n","    </button>\n","\n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    .colab-df-buttons div {\n","      margin-bottom: 4px;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","    <script>\n","      const buttonEl =\n","        document.querySelector('#df-bf3d925e-36d3-490d-a576-b06569740115 button.colab-df-convert');\n","      buttonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","      async function convertToInteractive(key) {\n","        const element = document.querySelector('#df-bf3d925e-36d3-490d-a576-b06569740115');\n","        const dataTable =\n","          await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                    [key], {});\n","        if (!dataTable) return;\n","\n","        const docLinkHtml = 'Like what you see? Visit the ' +\n","          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","          + ' to learn more about interactive tables.';\n","        element.innerHTML = '';\n","        dataTable['output_type'] = 'display_data';\n","        await google.colab.output.renderOutput(dataTable, element);\n","        const docLink = document.createElement('div');\n","        docLink.innerHTML = docLinkHtml;\n","        element.appendChild(docLink);\n","      }\n","    </script>\n","  </div>\n","\n","\n","<div id=\"df-785c38d8-f782-4c8a-8e35-796673ea23bb\">\n","  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-785c38d8-f782-4c8a-8e35-796673ea23bb')\"\n","            title=\"Suggest charts\"\n","            style=\"display:none;\">\n","\n","<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","     width=\"24px\">\n","    <g>\n","        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n","    </g>\n","</svg>\n","  </button>\n","\n","<style>\n","  .colab-df-quickchart {\n","      --bg-color: #E8F0FE;\n","      --fill-color: #1967D2;\n","      --hover-bg-color: #E2EBFA;\n","      --hover-fill-color: #174EA6;\n","      --disabled-fill-color: #AAA;\n","      --disabled-bg-color: #DDD;\n","  }\n","\n","  [theme=dark] .colab-df-quickchart {\n","      --bg-color: #3B4455;\n","      --fill-color: #D2E3FC;\n","      --hover-bg-color: #434B5C;\n","      --hover-fill-color: #FFFFFF;\n","      --disabled-bg-color: #3B4455;\n","      --disabled-fill-color: #666;\n","  }\n","\n","  .colab-df-quickchart {\n","    background-color: var(--bg-color);\n","    border: none;\n","    border-radius: 50%;\n","    cursor: pointer;\n","    display: none;\n","    fill: var(--fill-color);\n","    height: 32px;\n","    padding: 0;\n","    width: 32px;\n","  }\n","\n","  .colab-df-quickchart:hover {\n","    background-color: var(--hover-bg-color);\n","    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n","    fill: var(--button-hover-fill-color);\n","  }\n","\n","  .colab-df-quickchart-complete:disabled,\n","  .colab-df-quickchart-complete:disabled:hover {\n","    background-color: var(--disabled-bg-color);\n","    fill: var(--disabled-fill-color);\n","    box-shadow: none;\n","  }\n","\n","  .colab-df-spinner {\n","    border: 2px solid var(--fill-color);\n","    border-color: transparent;\n","    border-bottom-color: var(--fill-color);\n","    animation:\n","      spin 1s steps(1) infinite;\n","  }\n","\n","  @keyframes spin {\n","    0% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","      border-left-color: var(--fill-color);\n","    }\n","    20% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    30% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","      border-right-color: var(--fill-color);\n","    }\n","    40% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    60% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","    }\n","    80% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-bottom-color: var(--fill-color);\n","    }\n","    90% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","    }\n","  }\n","</style>\n","\n","  <script>\n","    async function quickchart(key) {\n","      const quickchartButtonEl =\n","        document.querySelector('#' + key + ' button');\n","      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n","      quickchartButtonEl.classList.add('colab-df-spinner');\n","      try {\n","        const charts = await google.colab.kernel.invokeFunction(\n","            'suggestCharts', [key], {});\n","      } catch (error) {\n","        console.error('Error during call to suggestCharts:', error);\n","      }\n","      quickchartButtonEl.classList.remove('colab-df-spinner');\n","      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n","    }\n","    (() => {\n","      let quickchartButtonEl =\n","        document.querySelector('#df-785c38d8-f782-4c8a-8e35-796673ea23bb button');\n","      quickchartButtonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","    })();\n","  </script>\n","</div>\n","    </div>\n","  </div>\n"],"text/plain":["      latitude  population\n","0        37.37      1537.0\n","1        34.26       809.0\n","2        33.78      1484.0\n","3        33.82        49.0\n","4        36.33       850.0\n","...        ...         ...\n","2995     34.42      1258.0\n","2996     34.06      3496.0\n","2997     36.30       693.0\n","2998     34.10        46.0\n","2999     34.42       753.0\n","\n","[3000 rows x 2 columns]"]},"execution_count":9,"metadata":{},"output_type":"execute_result"}],"source":["# Выбор нескольких столбцов [широта, кол-во жителей]\n","df[[\"latitude\", \"population\"]]"]},{"cell_type":"markdown","metadata":{"id":"cDzrHP5KiAxi"},"source":["![image.png]()"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":424},"executionInfo":{"elapsed":274,"status":"ok","timestamp":1708972159866,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"Nb6STwSff3z8","outputId":"5ea03f7d-5f4d-4e9e-d2da-b3dd079b600e"},"outputs":[{"data":{"application/vnd.google.colaboratory.intrinsic+json":{"summary":"{\n  \"name\": \"df[df['housing_median_age'] < 8]\",\n  \"rows\": 132,\n  \"fields\": [\n    {\n      \"column\": \"longitude\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 1.975156636064138,\n        \"min\": -122.79,\n        \"max\": -116.36,\n        \"num_unique_values\": 107,\n        \"samples\": [\n          -120.97,\n          -117.64,\n          -119.18\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"latitude\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 2.053260396501343,\n        \"min\": 32.69,\n        \"max\": 40.6,\n        \"num_unique_values\": 113,\n        \"samples\": [\n          32.86,\n          34.27,\n          35.3\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"housing_median_age\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 1.42421720020384,\n        \"min\": 1.0,\n        \"max\": 7.0,\n        \"num_unique_values\": 7,\n        \"samples\": [\n          5.0,\n          4.0,\n          2.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"total_rooms\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 5681.814905483209,\n        \"min\": 6.0,\n        \"max\": 30450.0,\n        \"num_unique_values\": 131,\n        \"samples\": [\n          2614.0,\n          27870.0,\n          158.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"total_bedrooms\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 1025.7149734419413,\n        \"min\": 2.0,\n        \"max\": 5033.0,\n        \"num_unique_values\": 126,\n        \"samples\": [\n          2162.0,\n          43.0,\n          351.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"population\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 2210.6791793901757,\n        \"min\": 8.0,\n        \"max\": 11935.0,\n        \"num_unique_values\": 132,\n        \"samples\": [\n          1821.0,\n          1518.0,\n          94.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"households\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 850.376511670413,\n        \"min\": 2.0,\n        \"max\": 4855.0,\n        \"num_unique_values\": 126,\n        \"samples\": [\n          1399.0,\n          57.0,\n          1007.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"median_income\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 1.8704682320451165,\n        \"min\": 1.0349,\n        \"max\": 15.0001,\n        \"num_unique_values\": 132,\n        \"samples\": [\n          4.8889,\n          2.9469,\n          2.5625\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"median_house_value\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 93480.51072306118,\n        \"min\": 53200.0,\n        \"max\": 500001.0,\n        \"num_unique_values\": 127,\n        \"samples\": [\n          311600.0,\n          360600.0,\n          340300.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}","type":"dataframe"},"text/html":["\n","  <div id=\"df-d4a3bd59-f731-4b97-b8f3-243790b45d99\" class=\"colab-df-container\">\n","    <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>longitude</th>\n","      <th>latitude</th>\n","      <th>housing_median_age</th>\n","      <th>total_rooms</th>\n","      <th>total_bedrooms</th>\n","      <th>population</th>\n","      <th>households</th>\n","      <th>median_income</th>\n","      <th>median_house_value</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>33</th>\n","      <td>-118.08</td>\n","      <td>34.55</td>\n","      <td>5.0</td>\n","      <td>16181.0</td>\n","      <td>2971.0</td>\n","      <td>8152.0</td>\n","      <td>2651.0</td>\n","      <td>4.5237</td>\n","      <td>141800.0</td>\n","    </tr>\n","    <tr>\n","      <th>45</th>\n","      <td>-117.24</td>\n","      <td>33.17</td>\n","      <td>4.0</td>\n","      <td>9998.0</td>\n","      <td>1874.0</td>\n","      <td>3925.0</td>\n","      <td>1672.0</td>\n","      <td>4.2826</td>\n","      <td>237500.0</td>\n","    </tr>\n","    <tr>\n","      <th>48</th>\n","      <td>-121.35</td>\n","      <td>38.00</td>\n","      <td>6.0</td>\n","      <td>1649.0</td>\n","      <td>369.0</td>\n","      <td>732.0</td>\n","      <td>350.0</td>\n","      <td>3.4231</td>\n","      <td>123800.0</td>\n","    </tr>\n","    <tr>\n","      <th>93</th>\n","      <td>-117.50</td>\n","      <td>33.87</td>\n","      <td>4.0</td>\n","      <td>6755.0</td>\n","      <td>1017.0</td>\n","      <td>2866.0</td>\n","      <td>850.0</td>\n","      <td>5.0493</td>\n","      <td>239800.0</td>\n","    </tr>\n","    <tr>\n","      <th>107</th>\n","      <td>-119.18</td>\n","      <td>34.27</td>\n","      <td>6.0</td>\n","      <td>2307.0</td>\n","      <td>386.0</td>\n","      <td>910.0</td>\n","      <td>364.0</td>\n","      <td>5.2150</td>\n","      <td>279500.0</td>\n","    </tr>\n","    <tr>\n","      <th>...</th>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","    </tr>\n","    <tr>\n","      <th>2859</th>\n","      <td>-118.22</td>\n","      <td>33.99</td>\n","      <td>6.0</td>\n","      <td>1499.0</td>\n","      <td>437.0</td>\n","      <td>1754.0</td>\n","      <td>447.0</td>\n","      <td>4.3164</td>\n","      <td>143200.0</td>\n","    </tr>\n","    <tr>\n","      <th>2913</th>\n","      <td>-122.39</td>\n","      <td>37.78</td>\n","      <td>3.0</td>\n","      <td>3464.0</td>\n","      <td>1179.0</td>\n","      <td>1441.0</td>\n","      <td>919.0</td>\n","      <td>4.7105</td>\n","      <td>275000.0</td>\n","    </tr>\n","    <tr>\n","      <th>2930</th>\n","      <td>-121.84</td>\n","      <td>37.29</td>\n","      <td>4.0</td>\n","      <td>2937.0</td>\n","      <td>648.0</td>\n","      <td>1780.0</td>\n","      <td>665.0</td>\n","      <td>4.3851</td>\n","      <td>160400.0</td>\n","    </tr>\n","    <tr>\n","      <th>2936</th>\n","      <td>-119.75</td>\n","      <td>36.87</td>\n","      <td>3.0</td>\n","      <td>13802.0</td>\n","      <td>2244.0</td>\n","      <td>5226.0</td>\n","      <td>1972.0</td>\n","      <td>5.0941</td>\n","      <td>143700.0</td>\n","    </tr>\n","    <tr>\n","      <th>2969</th>\n","      <td>-118.11</td>\n","      <td>34.68</td>\n","      <td>6.0</td>\n","      <td>7430.0</td>\n","      <td>1184.0</td>\n","      <td>3489.0</td>\n","      <td>1115.0</td>\n","      <td>5.3267</td>\n","      <td>140100.0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>132 rows × 9 columns</p>\n","</div>\n","    <div class=\"colab-df-buttons\">\n","\n","  <div class=\"colab-df-container\">\n","    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-d4a3bd59-f731-4b97-b8f3-243790b45d99')\"\n","            title=\"Convert this dataframe to an interactive table.\"\n","            style=\"display:none;\">\n","\n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n","    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n","  </svg>\n","    </button>\n","\n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    .colab-df-buttons div {\n","      margin-bottom: 4px;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","    <script>\n","      const buttonEl =\n","        document.querySelector('#df-d4a3bd59-f731-4b97-b8f3-243790b45d99 button.colab-df-convert');\n","      buttonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","      async function convertToInteractive(key) {\n","        const element = document.querySelector('#df-d4a3bd59-f731-4b97-b8f3-243790b45d99');\n","        const dataTable =\n","          await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                    [key], {});\n","        if (!dataTable) return;\n","\n","        const docLinkHtml = 'Like what you see? Visit the ' +\n","          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","          + ' to learn more about interactive tables.';\n","        element.innerHTML = '';\n","        dataTable['output_type'] = 'display_data';\n","        await google.colab.output.renderOutput(dataTable, element);\n","        const docLink = document.createElement('div');\n","        docLink.innerHTML = docLinkHtml;\n","        element.appendChild(docLink);\n","      }\n","    </script>\n","  </div>\n","\n","\n","<div id=\"df-0b7c7ab8-6867-4bd7-a429-ec7ff20dfde4\">\n","  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-0b7c7ab8-6867-4bd7-a429-ec7ff20dfde4')\"\n","            title=\"Suggest charts\"\n","            style=\"display:none;\">\n","\n","<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","     width=\"24px\">\n","    <g>\n","        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n","    </g>\n","</svg>\n","  </button>\n","\n","<style>\n","  .colab-df-quickchart {\n","      --bg-color: #E8F0FE;\n","      --fill-color: #1967D2;\n","      --hover-bg-color: #E2EBFA;\n","      --hover-fill-color: #174EA6;\n","      --disabled-fill-color: #AAA;\n","      --disabled-bg-color: #DDD;\n","  }\n","\n","  [theme=dark] .colab-df-quickchart {\n","      --bg-color: #3B4455;\n","      --fill-color: #D2E3FC;\n","      --hover-bg-color: #434B5C;\n","      --hover-fill-color: #FFFFFF;\n","      --disabled-bg-color: #3B4455;\n","      --disabled-fill-color: #666;\n","  }\n","\n","  .colab-df-quickchart {\n","    background-color: var(--bg-color);\n","    border: none;\n","    border-radius: 50%;\n","    cursor: pointer;\n","    display: none;\n","    fill: var(--fill-color);\n","    height: 32px;\n","    padding: 0;\n","    width: 32px;\n","  }\n","\n","  .colab-df-quickchart:hover {\n","    background-color: var(--hover-bg-color);\n","    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n","    fill: var(--button-hover-fill-color);\n","  }\n","\n","  .colab-df-quickchart-complete:disabled,\n","  .colab-df-quickchart-complete:disabled:hover {\n","    background-color: var(--disabled-bg-color);\n","    fill: var(--disabled-fill-color);\n","    box-shadow: none;\n","  }\n","\n","  .colab-df-spinner {\n","    border: 2px solid var(--fill-color);\n","    border-color: transparent;\n","    border-bottom-color: var(--fill-color);\n","    animation:\n","      spin 1s steps(1) infinite;\n","  }\n","\n","  @keyframes spin {\n","    0% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","      border-left-color: var(--fill-color);\n","    }\n","    20% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    30% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","      border-right-color: var(--fill-color);\n","    }\n","    40% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    60% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","    }\n","    80% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-bottom-color: var(--fill-color);\n","    }\n","    90% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","    }\n","  }\n","</style>\n","\n","  <script>\n","    async function quickchart(key) {\n","      const quickchartButtonEl =\n","        document.querySelector('#' + key + ' button');\n","      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n","      quickchartButtonEl.classList.add('colab-df-spinner');\n","      try {\n","        const charts = await google.colab.kernel.invokeFunction(\n","            'suggestCharts', [key], {});\n","      } catch (error) {\n","        console.error('Error during call to suggestCharts:', error);\n","      }\n","      quickchartButtonEl.classList.remove('colab-df-spinner');\n","      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n","    }\n","    (() => {\n","      let quickchartButtonEl =\n","        document.querySelector('#df-0b7c7ab8-6867-4bd7-a429-ec7ff20dfde4 button');\n","      quickchartButtonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","    })();\n","  </script>\n","</div>\n","    </div>\n","  </div>\n"],"text/plain":["      longitude  latitude  housing_median_age  total_rooms  total_bedrooms  \\\n","33      -118.08     34.55                 5.0      16181.0          2971.0   \n","45      -117.24     33.17                 4.0       9998.0          1874.0   \n","48      -121.35     38.00                 6.0       1649.0           369.0   \n","93      -117.50     33.87                 4.0       6755.0          1017.0   \n","107     -119.18     34.27                 6.0       2307.0           386.0   \n","...         ...       ...                 ...          ...             ...   \n","2859    -118.22     33.99                 6.0       1499.0           437.0   \n","2913    -122.39     37.78                 3.0       3464.0          1179.0   \n","2930    -121.84     37.29                 4.0       2937.0           648.0   \n","2936    -119.75     36.87                 3.0      13802.0          2244.0   \n","2969    -118.11     34.68                 6.0       7430.0          1184.0   \n","\n","      population  households  median_income  median_house_value  \n","33        8152.0      2651.0         4.5237            141800.0  \n","45        3925.0      1672.0         4.2826            237500.0  \n","48         732.0       350.0         3.4231            123800.0  \n","93        2866.0       850.0         5.0493            239800.0  \n","107        910.0       364.0         5.2150            279500.0  \n","...          ...         ...            ...                 ...  \n","2859      1754.0       447.0         4.3164            143200.0  \n","2913      1441.0       919.0         4.7105            275000.0  \n","2930      1780.0       665.0         4.3851            160400.0  \n","2936      5226.0      1972.0         5.0941            143700.0  \n","2969      3489.0      1115.0         5.3267            140100.0  \n","\n","[132 rows x 9 columns]"]},"execution_count":10,"metadata":{},"output_type":"execute_result"}],"source":["# Выбор определенного кол-ва рядов\n","# Синтаксис df[df[col] !=|==|>|<| значение]\n","df[df[\"housing_median_age\"] < 8]"]},{"cell_type":"markdown","metadata":{"id":"V7cd8n47iezF"},"source":["![image.png]()"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":424},"executionInfo":{"elapsed":397,"status":"ok","timestamp":1708934318964,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"sWftHHBZ_Dgg","outputId":"693e1feb-1774-4207-faf6-8a58d0fbbd6a"},"outputs":[{"data":{"application/vnd.google.colaboratory.intrinsic+json":{"summary":"{\n  \"name\": \"df[(df['housing_median_age'] > 20) & (df['total_rooms'] > 2000)]\",\n  \"rows\": 5624,\n  \"fields\": [\n    {\n      \"column\": \"longitude\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 2.0073830545098144,\n        \"min\": -124.27,\n        \"max\": -114.58,\n        \"num_unique_values\": 610,\n        \"samples\": [\n          -117.35,\n          -118.78,\n          -117.09\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"latitude\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 2.062271607609197,\n        \"min\": 32.56,\n        \"max\": 41.95,\n        \"num_unique_values\": 605,\n        \"samples\": [\n          38.58,\n          36.96,\n          33.08\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"housing_median_age\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 8.917063472925362,\n        \"min\": 21.0,\n        \"max\": 52.0,\n        \"num_unique_values\": 32,\n        \"samples\": [\n          45.0,\n          29.0,\n          49.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"total_rooms\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 1357.2775577008401,\n        \"min\": 2001.0,\n        \"max\": 17738.0,\n        \"num_unique_values\": 2470,\n        \"samples\": [\n          4909.0,\n          3741.0,\n          3780.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"total_bedrooms\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 314.9312524605555,\n        \"min\": 242.0,\n        \"max\": 3680.0,\n        \"num_unique_values\": 1120,\n        \"samples\": [\n          650.0,\n          340.0,\n          308.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"population\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 868.0872207705092,\n        \"min\": 98.0,\n        \"max\": 12427.0,\n        \"num_unique_values\": 2210,\n        \"samples\": [\n          1961.0,\n          1054.0,\n          1675.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"households\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 289.3964195744002,\n        \"min\": 42.0,\n        \"max\": 3522.0,\n        \"num_unique_values\": 1082,\n        \"samples\": [\n          1057.0,\n          555.0,\n          1004.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"median_income\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 1.9865586510004958,\n        \"min\": 0.6775,\n        \"max\": 15.0001,\n        \"num_unique_values\": 4785,\n        \"samples\": [\n          2.6607,\n          3.5912,\n          5.7361\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"median_house_value\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 126451.14691558601,\n        \"min\": 26900.0,\n        \"max\": 500001.0,\n        \"num_unique_values\": 2718,\n        \"samples\": [\n          103300.0,\n          129900.0,\n          254300.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}","type":"dataframe"},"text/html":["\n","  <div id=\"df-49d1cd05-2436-4981-981a-2c5aedec75bb\" class=\"colab-df-container\">\n","    <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>longitude</th>\n","      <th>latitude</th>\n","      <th>housing_median_age</th>\n","      <th>total_rooms</th>\n","      <th>total_bedrooms</th>\n","      <th>population</th>\n","      <th>households</th>\n","      <th>median_income</th>\n","      <th>median_house_value</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>6</th>\n","      <td>-114.58</td>\n","      <td>33.61</td>\n","      <td>25.0</td>\n","      <td>2907.0</td>\n","      <td>680.0</td>\n","      <td>1841.0</td>\n","      <td>633.0</td>\n","      <td>2.6768</td>\n","      <td>82400.0</td>\n","    </tr>\n","    <tr>\n","      <th>8</th>\n","      <td>-114.59</td>\n","      <td>33.61</td>\n","      <td>34.0</td>\n","      <td>4789.0</td>\n","      <td>1175.0</td>\n","      <td>3134.0</td>\n","      <td>1056.0</td>\n","      <td>2.1782</td>\n","      <td>58400.0</td>\n","    </tr>\n","    <tr>\n","      <th>13</th>\n","      <td>-114.61</td>\n","      <td>34.83</td>\n","      <td>31.0</td>\n","      <td>2478.0</td>\n","      <td>464.0</td>\n","      <td>1346.0</td>\n","      <td>479.0</td>\n","      <td>3.2120</td>\n","      <td>70400.0</td>\n","    </tr>\n","    <tr>\n","      <th>42</th>\n","      <td>-115.49</td>\n","      <td>32.67</td>\n","      <td>25.0</td>\n","      <td>2322.0</td>\n","      <td>573.0</td>\n","      <td>2185.0</td>\n","      <td>602.0</td>\n","      <td>1.3750</td>\n","      <td>70100.0</td>\n","    </tr>\n","    <tr>\n","      <th>45</th>\n","      <td>-115.50</td>\n","      <td>32.67</td>\n","      <td>35.0</td>\n","      <td>2159.0</td>\n","      <td>492.0</td>\n","      <td>1694.0</td>\n","      <td>475.0</td>\n","      <td>2.1776</td>\n","      <td>75500.0</td>\n","    </tr>\n","    <tr>\n","      <th>...</th>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","    </tr>\n","    <tr>\n","      <th>16986</th>\n","      <td>-124.19</td>\n","      <td>40.73</td>\n","      <td>21.0</td>\n","      <td>5694.0</td>\n","      <td>1056.0</td>\n","      <td>2907.0</td>\n","      <td>972.0</td>\n","      <td>3.5363</td>\n","      <td>90100.0</td>\n","    </tr>\n","    <tr>\n","      <th>16990</th>\n","      <td>-124.22</td>\n","      <td>41.73</td>\n","      <td>28.0</td>\n","      <td>3003.0</td>\n","      <td>699.0</td>\n","      <td>1530.0</td>\n","      <td>653.0</td>\n","      <td>1.7038</td>\n","      <td>78300.0</td>\n","    </tr>\n","    <tr>\n","      <th>16993</th>\n","      <td>-124.23</td>\n","      <td>40.54</td>\n","      <td>52.0</td>\n","      <td>2694.0</td>\n","      <td>453.0</td>\n","      <td>1152.0</td>\n","      <td>435.0</td>\n","      <td>3.0806</td>\n","      <td>106700.0</td>\n","    </tr>\n","    <tr>\n","      <th>16995</th>\n","      <td>-124.26</td>\n","      <td>40.58</td>\n","      <td>52.0</td>\n","      <td>2217.0</td>\n","      <td>394.0</td>\n","      <td>907.0</td>\n","      <td>369.0</td>\n","      <td>2.3571</td>\n","      <td>111400.0</td>\n","    </tr>\n","    <tr>\n","      <th>16996</th>\n","      <td>-124.27</td>\n","      <td>40.69</td>\n","      <td>36.0</td>\n","      <td>2349.0</td>\n","      <td>528.0</td>\n","      <td>1194.0</td>\n","      <td>465.0</td>\n","      <td>2.5179</td>\n","      <td>79000.0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>5624 rows × 9 columns</p>\n","</div>\n","    <div class=\"colab-df-buttons\">\n","\n","  <div class=\"colab-df-container\">\n","    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-49d1cd05-2436-4981-981a-2c5aedec75bb')\"\n","            title=\"Convert this dataframe to an interactive table.\"\n","            style=\"display:none;\">\n","\n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n","    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n","  </svg>\n","    </button>\n","\n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    .colab-df-buttons div {\n","      margin-bottom: 4px;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","    <script>\n","      const buttonEl =\n","        document.querySelector('#df-49d1cd05-2436-4981-981a-2c5aedec75bb button.colab-df-convert');\n","      buttonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","      async function convertToInteractive(key) {\n","        const element = document.querySelector('#df-49d1cd05-2436-4981-981a-2c5aedec75bb');\n","        const dataTable =\n","          await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                    [key], {});\n","        if (!dataTable) return;\n","\n","        const docLinkHtml = 'Like what you see? Visit the ' +\n","          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","          + ' to learn more about interactive tables.';\n","        element.innerHTML = '';\n","        dataTable['output_type'] = 'display_data';\n","        await google.colab.output.renderOutput(dataTable, element);\n","        const docLink = document.createElement('div');\n","        docLink.innerHTML = docLinkHtml;\n","        element.appendChild(docLink);\n","      }\n","    </script>\n","  </div>\n","\n","\n","<div id=\"df-6b338f3e-e160-43ee-b59a-81acfad5be07\">\n","  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-6b338f3e-e160-43ee-b59a-81acfad5be07')\"\n","            title=\"Suggest charts\"\n","            style=\"display:none;\">\n","\n","<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","     width=\"24px\">\n","    <g>\n","        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n","    </g>\n","</svg>\n","  </button>\n","\n","<style>\n","  .colab-df-quickchart {\n","      --bg-color: #E8F0FE;\n","      --fill-color: #1967D2;\n","      --hover-bg-color: #E2EBFA;\n","      --hover-fill-color: #174EA6;\n","      --disabled-fill-color: #AAA;\n","      --disabled-bg-color: #DDD;\n","  }\n","\n","  [theme=dark] .colab-df-quickchart {\n","      --bg-color: #3B4455;\n","      --fill-color: #D2E3FC;\n","      --hover-bg-color: #434B5C;\n","      --hover-fill-color: #FFFFFF;\n","      --disabled-bg-color: #3B4455;\n","      --disabled-fill-color: #666;\n","  }\n","\n","  .colab-df-quickchart {\n","    background-color: var(--bg-color);\n","    border: none;\n","    border-radius: 50%;\n","    cursor: pointer;\n","    display: none;\n","    fill: var(--fill-color);\n","    height: 32px;\n","    padding: 0;\n","    width: 32px;\n","  }\n","\n","  .colab-df-quickchart:hover {\n","    background-color: var(--hover-bg-color);\n","    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n","    fill: var(--button-hover-fill-color);\n","  }\n","\n","  .colab-df-quickchart-complete:disabled,\n","  .colab-df-quickchart-complete:disabled:hover {\n","    background-color: var(--disabled-bg-color);\n","    fill: var(--disabled-fill-color);\n","    box-shadow: none;\n","  }\n","\n","  .colab-df-spinner {\n","    border: 2px solid var(--fill-color);\n","    border-color: transparent;\n","    border-bottom-color: var(--fill-color);\n","    animation:\n","      spin 1s steps(1) infinite;\n","  }\n","\n","  @keyframes spin {\n","    0% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","      border-left-color: var(--fill-color);\n","    }\n","    20% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    30% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","      border-right-color: var(--fill-color);\n","    }\n","    40% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    60% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","    }\n","    80% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-bottom-color: var(--fill-color);\n","    }\n","    90% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","    }\n","  }\n","</style>\n","\n","  <script>\n","    async function quickchart(key) {\n","      const quickchartButtonEl =\n","        document.querySelector('#' + key + ' button');\n","      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n","      quickchartButtonEl.classList.add('colab-df-spinner');\n","      try {\n","        const charts = await google.colab.kernel.invokeFunction(\n","            'suggestCharts', [key], {});\n","      } catch (error) {\n","        console.error('Error during call to suggestCharts:', error);\n","      }\n","      quickchartButtonEl.classList.remove('colab-df-spinner');\n","      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n","    }\n","    (() => {\n","      let quickchartButtonEl =\n","        document.querySelector('#df-6b338f3e-e160-43ee-b59a-81acfad5be07 button');\n","      quickchartButtonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","    })();\n","  </script>\n","</div>\n","    </div>\n","  </div>\n"],"text/plain":["       longitude  latitude  housing_median_age  total_rooms  total_bedrooms  \\\n","6        -114.58     33.61                25.0       2907.0           680.0   \n","8        -114.59     33.61                34.0       4789.0          1175.0   \n","13       -114.61     34.83                31.0       2478.0           464.0   \n","42       -115.49     32.67                25.0       2322.0           573.0   \n","45       -115.50     32.67                35.0       2159.0           492.0   \n","...          ...       ...                 ...          ...             ...   \n","16986    -124.19     40.73                21.0       5694.0          1056.0   \n","16990    -124.22     41.73                28.0       3003.0           699.0   \n","16993    -124.23     40.54                52.0       2694.0           453.0   \n","16995    -124.26     40.58                52.0       2217.0           394.0   \n","16996    -124.27     40.69                36.0       2349.0           528.0   \n","\n","       population  households  median_income  median_house_value  \n","6          1841.0       633.0         2.6768             82400.0  \n","8          3134.0      1056.0         2.1782             58400.0  \n","13         1346.0       479.0         3.2120             70400.0  \n","42         2185.0       602.0         1.3750             70100.0  \n","45         1694.0       475.0         2.1776             75500.0  \n","...           ...         ...            ...                 ...  \n","16986      2907.0       972.0         3.5363             90100.0  \n","16990      1530.0       653.0         1.7038             78300.0  \n","16993      1152.0       435.0         3.0806            106700.0  \n","16995       907.0       369.0         2.3571            111400.0  \n","16996      1194.0       465.0         2.5179             79000.0  \n","\n","[5624 rows x 9 columns]"]},"execution_count":28,"metadata":{},"output_type":"execute_result"}],"source":["# Для отбора можно использовать несколько условий одновременно\n","# Знак & означает 'and', а знак | 'or'\n","df[(df[\"housing_median_age\"] > 20) & (df[\"total_rooms\"] > 2000)]"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":424},"executionInfo":{"elapsed":310,"status":"ok","timestamp":1708934048415,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"cAhBaALn_mrP","outputId":"0bca413e-f2cc-45da-c0b3-4f50755da978"},"outputs":[{"data":{"application/vnd.google.colaboratory.intrinsic+json":{"summary":"{\n  \"name\": \"df[(df['housing_median_age'] > 20) | (df['total_rooms'] > 2000)]\",\n  \"rows\": 15409,\n  \"fields\": [\n    {\n      \"column\": \"longitude\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 1.994614297032739,\n        \"min\": -124.35,\n        \"max\": -114.31,\n        \"num_unique_values\": 781,\n        \"samples\": [\n          -121.92,\n          -121.84,\n          -121.4\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"latitude\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 2.1106590898804725,\n        \"min\": 32.55,\n        \"max\": 41.95,\n        \"num_unique_values\": 820,\n        \"samples\": [\n          38.78,\n          36.1,\n          34.07\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"housing_median_age\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 12.244270151571156,\n        \"min\": 1.0,\n        \"max\": 52.0,\n        \"num_unique_values\": 52,\n        \"samples\": [\n          33.0,\n          4.0,\n          47.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"total_rooms\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 2239.0070446138798,\n        \"min\": 8.0,\n        \"max\": 37937.0,\n        \"num_unique_values\": 5448,\n        \"samples\": [\n          3257.0,\n          94.0,\n          3513.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"total_bedrooms\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 431.9766094432016,\n        \"min\": 1.0,\n        \"max\": 6445.0,\n        \"num_unique_values\": 1845,\n        \"samples\": [\n          999.0,\n          270.0,\n          315.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"population\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 1173.4584663309424,\n        \"min\": 8.0,\n        \"max\": 35682.0,\n        \"num_unique_values\": 3635,\n        \"samples\": [\n          2317.0,\n          841.0,\n          1396.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"households\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 393.21727832583696,\n        \"min\": 1.0,\n        \"max\": 6082.0,\n        \"num_unique_values\": 1738,\n        \"samples\": [\n          138.0,\n          3931.0,\n          1296.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"median_income\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 1.8984902765976865,\n        \"min\": 0.4999,\n        \"max\": 15.0001,\n        \"num_unique_values\": 10473,\n        \"samples\": [\n          7.9739,\n          5.7245,\n          3.0559\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"median_house_value\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 116449.03897732389,\n        \"min\": 14999.0,\n        \"max\": 500001.0,\n        \"num_unique_values\": 3650,\n        \"samples\": [\n          219000.0,\n          280100.0,\n          294700.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}","type":"dataframe"},"text/html":["\n","  <div id=\"df-60407201-fc93-4321-82e6-739edfc171d5\" class=\"colab-df-container\">\n","    <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>longitude</th>\n","      <th>latitude</th>\n","      <th>housing_median_age</th>\n","      <th>total_rooms</th>\n","      <th>total_bedrooms</th>\n","      <th>population</th>\n","      <th>households</th>\n","      <th>median_income</th>\n","      <th>median_house_value</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>-114.31</td>\n","      <td>34.19</td>\n","      <td>15.0</td>\n","      <td>5612.0</td>\n","      <td>1283.0</td>\n","      <td>1015.0</td>\n","      <td>472.0</td>\n","      <td>1.4936</td>\n","      <td>66900.0</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>-114.47</td>\n","      <td>34.40</td>\n","      <td>19.0</td>\n","      <td>7650.0</td>\n","      <td>1901.0</td>\n","      <td>1129.0</td>\n","      <td>463.0</td>\n","      <td>1.8200</td>\n","      <td>80100.0</td>\n","    </tr>\n","    <tr>\n","      <th>5</th>\n","      <td>-114.58</td>\n","      <td>33.63</td>\n","      <td>29.0</td>\n","      <td>1387.0</td>\n","      <td>236.0</td>\n","      <td>671.0</td>\n","      <td>239.0</td>\n","      <td>3.3438</td>\n","      <td>74000.0</td>\n","    </tr>\n","    <tr>\n","      <th>6</th>\n","      <td>-114.58</td>\n","      <td>33.61</td>\n","      <td>25.0</td>\n","      <td>2907.0</td>\n","      <td>680.0</td>\n","      <td>1841.0</td>\n","      <td>633.0</td>\n","      <td>2.6768</td>\n","      <td>82400.0</td>\n","    </tr>\n","    <tr>\n","      <th>7</th>\n","      <td>-114.59</td>\n","      <td>34.83</td>\n","      <td>41.0</td>\n","      <td>812.0</td>\n","      <td>168.0</td>\n","      <td>375.0</td>\n","      <td>158.0</td>\n","      <td>1.7083</td>\n","      <td>48500.0</td>\n","    </tr>\n","    <tr>\n","      <th>...</th>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","      <td>...</td>\n","    </tr>\n","    <tr>\n","      <th>16995</th>\n","      <td>-124.26</td>\n","      <td>40.58</td>\n","      <td>52.0</td>\n","      <td>2217.0</td>\n","      <td>394.0</td>\n","      <td>907.0</td>\n","      <td>369.0</td>\n","      <td>2.3571</td>\n","      <td>111400.0</td>\n","    </tr>\n","    <tr>\n","      <th>16996</th>\n","      <td>-124.27</td>\n","      <td>40.69</td>\n","      <td>36.0</td>\n","      <td>2349.0</td>\n","      <td>528.0</td>\n","      <td>1194.0</td>\n","      <td>465.0</td>\n","      <td>2.5179</td>\n","      <td>79000.0</td>\n","    </tr>\n","    <tr>\n","      <th>16997</th>\n","      <td>-124.30</td>\n","      <td>41.84</td>\n","      <td>17.0</td>\n","      <td>2677.0</td>\n","      <td>531.0</td>\n","      <td>1244.0</td>\n","      <td>456.0</td>\n","      <td>3.0313</td>\n","      <td>103600.0</td>\n","    </tr>\n","    <tr>\n","      <th>16998</th>\n","      <td>-124.30</td>\n","      <td>41.80</td>\n","      <td>19.0</td>\n","      <td>2672.0</td>\n","      <td>552.0</td>\n","      <td>1298.0</td>\n","      <td>478.0</td>\n","      <td>1.9797</td>\n","      <td>85800.0</td>\n","    </tr>\n","    <tr>\n","      <th>16999</th>\n","      <td>-124.35</td>\n","      <td>40.54</td>\n","      <td>52.0</td>\n","      <td>1820.0</td>\n","      <td>300.0</td>\n","      <td>806.0</td>\n","      <td>270.0</td>\n","      <td>3.0147</td>\n","      <td>94600.0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>15409 rows × 9 columns</p>\n","</div>\n","    <div class=\"colab-df-buttons\">\n","\n","  <div class=\"colab-df-container\">\n","    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-60407201-fc93-4321-82e6-739edfc171d5')\"\n","            title=\"Convert this dataframe to an interactive table.\"\n","            style=\"display:none;\">\n","\n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n","    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n","  </svg>\n","    </button>\n","\n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    .colab-df-buttons div {\n","      margin-bottom: 4px;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","    <script>\n","      const buttonEl =\n","        document.querySelector('#df-60407201-fc93-4321-82e6-739edfc171d5 button.colab-df-convert');\n","      buttonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","      async function convertToInteractive(key) {\n","        const element = document.querySelector('#df-60407201-fc93-4321-82e6-739edfc171d5');\n","        const dataTable =\n","          await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                    [key], {});\n","        if (!dataTable) return;\n","\n","        const docLinkHtml = 'Like what you see? Visit the ' +\n","          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","          + ' to learn more about interactive tables.';\n","        element.innerHTML = '';\n","        dataTable['output_type'] = 'display_data';\n","        await google.colab.output.renderOutput(dataTable, element);\n","        const docLink = document.createElement('div');\n","        docLink.innerHTML = docLinkHtml;\n","        element.appendChild(docLink);\n","      }\n","    </script>\n","  </div>\n","\n","\n","<div id=\"df-392dbce5-8c6b-4341-aad5-1e02a7c9a08c\">\n","  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-392dbce5-8c6b-4341-aad5-1e02a7c9a08c')\"\n","            title=\"Suggest charts\"\n","            style=\"display:none;\">\n","\n","<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","     width=\"24px\">\n","    <g>\n","        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n","    </g>\n","</svg>\n","  </button>\n","\n","<style>\n","  .colab-df-quickchart {\n","      --bg-color: #E8F0FE;\n","      --fill-color: #1967D2;\n","      --hover-bg-color: #E2EBFA;\n","      --hover-fill-color: #174EA6;\n","      --disabled-fill-color: #AAA;\n","      --disabled-bg-color: #DDD;\n","  }\n","\n","  [theme=dark] .colab-df-quickchart {\n","      --bg-color: #3B4455;\n","      --fill-color: #D2E3FC;\n","      --hover-bg-color: #434B5C;\n","      --hover-fill-color: #FFFFFF;\n","      --disabled-bg-color: #3B4455;\n","      --disabled-fill-color: #666;\n","  }\n","\n","  .colab-df-quickchart {\n","    background-color: var(--bg-color);\n","    border: none;\n","    border-radius: 50%;\n","    cursor: pointer;\n","    display: none;\n","    fill: var(--fill-color);\n","    height: 32px;\n","    padding: 0;\n","    width: 32px;\n","  }\n","\n","  .colab-df-quickchart:hover {\n","    background-color: var(--hover-bg-color);\n","    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n","    fill: var(--button-hover-fill-color);\n","  }\n","\n","  .colab-df-quickchart-complete:disabled,\n","  .colab-df-quickchart-complete:disabled:hover {\n","    background-color: var(--disabled-bg-color);\n","    fill: var(--disabled-fill-color);\n","    box-shadow: none;\n","  }\n","\n","  .colab-df-spinner {\n","    border: 2px solid var(--fill-color);\n","    border-color: transparent;\n","    border-bottom-color: var(--fill-color);\n","    animation:\n","      spin 1s steps(1) infinite;\n","  }\n","\n","  @keyframes spin {\n","    0% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","      border-left-color: var(--fill-color);\n","    }\n","    20% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    30% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","      border-right-color: var(--fill-color);\n","    }\n","    40% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    60% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","    }\n","    80% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-bottom-color: var(--fill-color);\n","    }\n","    90% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","    }\n","  }\n","</style>\n","\n","  <script>\n","    async function quickchart(key) {\n","      const quickchartButtonEl =\n","        document.querySelector('#' + key + ' button');\n","      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n","      quickchartButtonEl.classList.add('colab-df-spinner');\n","      try {\n","        const charts = await google.colab.kernel.invokeFunction(\n","            'suggestCharts', [key], {});\n","      } catch (error) {\n","        console.error('Error during call to suggestCharts:', error);\n","      }\n","      quickchartButtonEl.classList.remove('colab-df-spinner');\n","      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n","    }\n","    (() => {\n","      let quickchartButtonEl =\n","        document.querySelector('#df-392dbce5-8c6b-4341-aad5-1e02a7c9a08c button');\n","      quickchartButtonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","    })();\n","  </script>\n","</div>\n","    </div>\n","  </div>\n"],"text/plain":["       longitude  latitude  housing_median_age  total_rooms  total_bedrooms  \\\n","0        -114.31     34.19                15.0       5612.0          1283.0   \n","1        -114.47     34.40                19.0       7650.0          1901.0   \n","5        -114.58     33.63                29.0       1387.0           236.0   \n","6        -114.58     33.61                25.0       2907.0           680.0   \n","7        -114.59     34.83                41.0        812.0           168.0   \n","...          ...       ...                 ...          ...             ...   \n","16995    -124.26     40.58                52.0       2217.0           394.0   \n","16996    -124.27     40.69                36.0       2349.0           528.0   \n","16997    -124.30     41.84                17.0       2677.0           531.0   \n","16998    -124.30     41.80                19.0       2672.0           552.0   \n","16999    -124.35     40.54                52.0       1820.0           300.0   \n","\n","       population  households  median_income  median_house_value  \n","0          1015.0       472.0         1.4936             66900.0  \n","1          1129.0       463.0         1.8200             80100.0  \n","5           671.0       239.0         3.3438             74000.0  \n","6          1841.0       633.0         2.6768             82400.0  \n","7           375.0       158.0         1.7083             48500.0  \n","...           ...         ...            ...                 ...  \n","16995       907.0       369.0         2.3571            111400.0  \n","16996      1194.0       465.0         2.5179             79000.0  \n","16997      1244.0       456.0         3.0313            103600.0  \n","16998      1298.0       478.0         1.9797             85800.0  \n","16999       806.0       270.0         3.0147             94600.0  \n","\n","[15409 rows x 9 columns]"]},"execution_count":21,"metadata":{},"output_type":"execute_result"}],"source":["df[(df[\"housing_median_age\"] > 20) | (df[\"total_rooms\"] > 2000)]"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":424},"executionInfo":{"elapsed":317,"status":"ok","timestamp":1708934323954,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"h0kTGcMNHRnW","outputId":"9e0708fd-b5c5-43b4-fa28-03d01f2590f1"},"outputs":[{"data":{"application/vnd.google.colaboratory.intrinsic+json":{"summary":"{\n  \"name\": \"df[df['housing_median_age'] < 10][['total_bedrooms', 'total_rooms']]\",\n  \"rows\": 1087,\n  \"fields\": [\n    {\n      \"column\": \"total_bedrooms\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 779.3563045752207,\n        \"min\": 2.0,\n        \"max\": 5471.0,\n        \"num_unique_values\": 823,\n        \"samples\": [\n          286.0,\n          1461.0,\n          785.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"total_rooms\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 4608.227239254542,\n        \"min\": 2.0,\n        \"max\": 37937.0,\n        \"num_unique_values\": 1026,\n        \"samples\": [\n          4380.0,\n          11275.0,\n          4246.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}","type":"dataframe"},"text/html":["\n","  <div id=\"df-97bd7c48-7615-4a1a-a4f3-7c087eaa6dc2\" class=\"colab-df-container\">\n","    <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>total_bedrooms</th>\n","      <th>total_rooms</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>58</th>\n","      <td>581.0</td>\n","      <td>2804.0</td>\n","    </tr>\n","    <tr>\n","      <th>75</th>\n","      <td>606.0</td>\n","      <td>2652.0</td>\n","    </tr>\n","    <tr>\n","      <th>95</th>\n","      <td>143.0</td>\n","      <td>805.0</td>\n","    </tr>\n","    <tr>\n","      <th>98</th>\n","      <td>414.0</td>\n","      <td>2494.0</td>\n","    </tr>\n","    <tr>\n","      <th>100</th>\n","      <td>307.0</td>\n","      <td>2183.0</td>\n","    </tr>\n","    <tr>\n","      <th>...</th>\n","      <td>...</td>\n","      <td>...</td>\n","    </tr>\n","    <tr>\n","      <th>16679</th>\n","      <td>1417.0</td>\n","      <td>6837.0</td>\n","    </tr>\n","    <tr>\n","      <th>16680</th>\n","      <td>885.0</td>\n","      <td>4967.0</td>\n","    </tr>\n","    <tr>\n","      <th>16692</th>\n","      <td>1088.0</td>\n","      <td>6190.0</td>\n","    </tr>\n","    <tr>\n","      <th>16776</th>\n","      <td>637.0</td>\n","      <td>3223.0</td>\n","    </tr>\n","    <tr>\n","      <th>16854</th>\n","      <td>1019.0</td>\n","      <td>5409.0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>1087 rows × 2 columns</p>\n","</div>\n","    <div class=\"colab-df-buttons\">\n","\n","  <div class=\"colab-df-container\">\n","    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-97bd7c48-7615-4a1a-a4f3-7c087eaa6dc2')\"\n","            title=\"Convert this dataframe to an interactive table.\"\n","            style=\"display:none;\">\n","\n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n","    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n","  </svg>\n","    </button>\n","\n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    .colab-df-buttons div {\n","      margin-bottom: 4px;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","    <script>\n","      const buttonEl =\n","        document.querySelector('#df-97bd7c48-7615-4a1a-a4f3-7c087eaa6dc2 button.colab-df-convert');\n","      buttonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","      async function convertToInteractive(key) {\n","        const element = document.querySelector('#df-97bd7c48-7615-4a1a-a4f3-7c087eaa6dc2');\n","        const dataTable =\n","          await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                    [key], {});\n","        if (!dataTable) return;\n","\n","        const docLinkHtml = 'Like what you see? Visit the ' +\n","          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","          + ' to learn more about interactive tables.';\n","        element.innerHTML = '';\n","        dataTable['output_type'] = 'display_data';\n","        await google.colab.output.renderOutput(dataTable, element);\n","        const docLink = document.createElement('div');\n","        docLink.innerHTML = docLinkHtml;\n","        element.appendChild(docLink);\n","      }\n","    </script>\n","  </div>\n","\n","\n","<div id=\"df-c443329f-47d9-4059-80f5-4cb25b0fe02d\">\n","  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-c443329f-47d9-4059-80f5-4cb25b0fe02d')\"\n","            title=\"Suggest charts\"\n","            style=\"display:none;\">\n","\n","<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","     width=\"24px\">\n","    <g>\n","        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n","    </g>\n","</svg>\n","  </button>\n","\n","<style>\n","  .colab-df-quickchart {\n","      --bg-color: #E8F0FE;\n","      --fill-color: #1967D2;\n","      --hover-bg-color: #E2EBFA;\n","      --hover-fill-color: #174EA6;\n","      --disabled-fill-color: #AAA;\n","      --disabled-bg-color: #DDD;\n","  }\n","\n","  [theme=dark] .colab-df-quickchart {\n","      --bg-color: #3B4455;\n","      --fill-color: #D2E3FC;\n","      --hover-bg-color: #434B5C;\n","      --hover-fill-color: #FFFFFF;\n","      --disabled-bg-color: #3B4455;\n","      --disabled-fill-color: #666;\n","  }\n","\n","  .colab-df-quickchart {\n","    background-color: var(--bg-color);\n","    border: none;\n","    border-radius: 50%;\n","    cursor: pointer;\n","    display: none;\n","    fill: var(--fill-color);\n","    height: 32px;\n","    padding: 0;\n","    width: 32px;\n","  }\n","\n","  .colab-df-quickchart:hover {\n","    background-color: var(--hover-bg-color);\n","    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n","    fill: var(--button-hover-fill-color);\n","  }\n","\n","  .colab-df-quickchart-complete:disabled,\n","  .colab-df-quickchart-complete:disabled:hover {\n","    background-color: var(--disabled-bg-color);\n","    fill: var(--disabled-fill-color);\n","    box-shadow: none;\n","  }\n","\n","  .colab-df-spinner {\n","    border: 2px solid var(--fill-color);\n","    border-color: transparent;\n","    border-bottom-color: var(--fill-color);\n","    animation:\n","      spin 1s steps(1) infinite;\n","  }\n","\n","  @keyframes spin {\n","    0% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","      border-left-color: var(--fill-color);\n","    }\n","    20% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    30% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","      border-right-color: var(--fill-color);\n","    }\n","    40% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    60% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","    }\n","    80% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-bottom-color: var(--fill-color);\n","    }\n","    90% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","    }\n","  }\n","</style>\n","\n","  <script>\n","    async function quickchart(key) {\n","      const quickchartButtonEl =\n","        document.querySelector('#' + key + ' button');\n","      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n","      quickchartButtonEl.classList.add('colab-df-spinner');\n","      try {\n","        const charts = await google.colab.kernel.invokeFunction(\n","            'suggestCharts', [key], {});\n","      } catch (error) {\n","        console.error('Error during call to suggestCharts:', error);\n","      }\n","      quickchartButtonEl.classList.remove('colab-df-spinner');\n","      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n","    }\n","    (() => {\n","      let quickchartButtonEl =\n","        document.querySelector('#df-c443329f-47d9-4059-80f5-4cb25b0fe02d button');\n","      quickchartButtonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","    })();\n","  </script>\n","</div>\n","    </div>\n","  </div>\n"],"text/plain":["       total_bedrooms  total_rooms\n","58              581.0       2804.0\n","75              606.0       2652.0\n","95              143.0        805.0\n","98              414.0       2494.0\n","100             307.0       2183.0\n","...               ...          ...\n","16679          1417.0       6837.0\n","16680           885.0       4967.0\n","16692          1088.0       6190.0\n","16776           637.0       3223.0\n","16854          1019.0       5409.0\n","\n","[1087 rows x 2 columns]"]},"execution_count":29,"metadata":{},"output_type":"execute_result"}],"source":["df[df[\"housing_median_age\"] < 10][[\"total_bedrooms\", \"total_rooms\"]]"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":424},"executionInfo":{"elapsed":285,"status":"ok","timestamp":1708934346185,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"6loWpfyhXaN8","outputId":"400214e4-878a-46d4-a0d1-edd13b1e0f43"},"outputs":[{"data":{"application/vnd.google.colaboratory.intrinsic+json":{"summary":"{\n  \"name\": \"df\",\n  \"rows\": 178,\n  \"fields\": [\n    {\n      \"column\": \"total_bedrooms\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 83.96972820152087,\n        \"min\": 1.0,\n        \"max\": 511.0,\n        \"num_unique_values\": 75,\n        \"samples\": [\n          43.0,\n          31.0,\n          67.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"total_rooms\",\n      \"properties\": {\n        \"dtype\": \"number\",\n        \"std\": 379.8668122160321,\n        \"min\": 2.0,\n        \"max\": 2213.0,\n        \"num_unique_values\": 134,\n        \"samples\": [\n          64.0,\n          232.0,\n          858.0\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}","type":"dataframe"},"text/html":["\n","  <div id=\"df-69c55ee2-0e73-4f36-a91c-64b5ca19b6a6\" class=\"colab-df-container\">\n","    <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>total_bedrooms</th>\n","      <th>total_rooms</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>17</th>\n","      <td>33.0</td>\n","      <td>44.0</td>\n","    </tr>\n","    <tr>\n","      <th>19</th>\n","      <td>24.0</td>\n","      <td>97.0</td>\n","    </tr>\n","    <tr>\n","      <th>113</th>\n","      <td>18.0</td>\n","      <td>96.0</td>\n","    </tr>\n","    <tr>\n","      <th>116</th>\n","      <td>49.0</td>\n","      <td>208.0</td>\n","    </tr>\n","    <tr>\n","      <th>120</th>\n","      <td>43.0</td>\n","      <td>186.0</td>\n","    </tr>\n","    <tr>\n","      <th>...</th>\n","      <td>...</td>\n","      <td>...</td>\n","    </tr>\n","    <tr>\n","      <th>16643</th>\n","      <td>73.0</td>\n","      <td>255.0</td>\n","    </tr>\n","    <tr>\n","      <th>16733</th>\n","      <td>114.0</td>\n","      <td>411.0</td>\n","    </tr>\n","    <tr>\n","      <th>16743</th>\n","      <td>18.0</td>\n","      <td>89.0</td>\n","    </tr>\n","    <tr>\n","      <th>16801</th>\n","      <td>28.0</td>\n","      <td>98.0</td>\n","    </tr>\n","    <tr>\n","      <th>16851</th>\n","      <td>35.0</td>\n","      <td>133.0</td>\n","    </tr>\n","  </tbody>\n","</table>\n","<p>178 rows × 2 columns</p>\n","</div>\n","    <div class=\"colab-df-buttons\">\n","\n","  <div class=\"colab-df-container\">\n","    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-69c55ee2-0e73-4f36-a91c-64b5ca19b6a6')\"\n","            title=\"Convert this dataframe to an interactive table.\"\n","            style=\"display:none;\">\n","\n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n","    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n","  </svg>\n","    </button>\n","\n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    .colab-df-buttons div {\n","      margin-bottom: 4px;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","    <script>\n","      const buttonEl =\n","        document.querySelector('#df-69c55ee2-0e73-4f36-a91c-64b5ca19b6a6 button.colab-df-convert');\n","      buttonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","      async function convertToInteractive(key) {\n","        const element = document.querySelector('#df-69c55ee2-0e73-4f36-a91c-64b5ca19b6a6');\n","        const dataTable =\n","          await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                    [key], {});\n","        if (!dataTable) return;\n","\n","        const docLinkHtml = 'Like what you see? Visit the ' +\n","          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","          + ' to learn more about interactive tables.';\n","        element.innerHTML = '';\n","        dataTable['output_type'] = 'display_data';\n","        await google.colab.output.renderOutput(dataTable, element);\n","        const docLink = document.createElement('div');\n","        docLink.innerHTML = docLinkHtml;\n","        element.appendChild(docLink);\n","      }\n","    </script>\n","  </div>\n","\n","\n","<div id=\"df-c95a7118-7bcb-40ea-bf37-2ed0a2d868fa\">\n","  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-c95a7118-7bcb-40ea-bf37-2ed0a2d868fa')\"\n","            title=\"Suggest charts\"\n","            style=\"display:none;\">\n","\n","<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","     width=\"24px\">\n","    <g>\n","        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n","    </g>\n","</svg>\n","  </button>\n","\n","<style>\n","  .colab-df-quickchart {\n","      --bg-color: #E8F0FE;\n","      --fill-color: #1967D2;\n","      --hover-bg-color: #E2EBFA;\n","      --hover-fill-color: #174EA6;\n","      --disabled-fill-color: #AAA;\n","      --disabled-bg-color: #DDD;\n","  }\n","\n","  [theme=dark] .colab-df-quickchart {\n","      --bg-color: #3B4455;\n","      --fill-color: #D2E3FC;\n","      --hover-bg-color: #434B5C;\n","      --hover-fill-color: #FFFFFF;\n","      --disabled-bg-color: #3B4455;\n","      --disabled-fill-color: #666;\n","  }\n","\n","  .colab-df-quickchart {\n","    background-color: var(--bg-color);\n","    border: none;\n","    border-radius: 50%;\n","    cursor: pointer;\n","    display: none;\n","    fill: var(--fill-color);\n","    height: 32px;\n","    padding: 0;\n","    width: 32px;\n","  }\n","\n","  .colab-df-quickchart:hover {\n","    background-color: var(--hover-bg-color);\n","    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n","    fill: var(--button-hover-fill-color);\n","  }\n","\n","  .colab-df-quickchart-complete:disabled,\n","  .colab-df-quickchart-complete:disabled:hover {\n","    background-color: var(--disabled-bg-color);\n","    fill: var(--disabled-fill-color);\n","    box-shadow: none;\n","  }\n","\n","  .colab-df-spinner {\n","    border: 2px solid var(--fill-color);\n","    border-color: transparent;\n","    border-bottom-color: var(--fill-color);\n","    animation:\n","      spin 1s steps(1) infinite;\n","  }\n","\n","  @keyframes spin {\n","    0% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","      border-left-color: var(--fill-color);\n","    }\n","    20% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    30% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","      border-right-color: var(--fill-color);\n","    }\n","    40% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    60% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","    }\n","    80% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-bottom-color: var(--fill-color);\n","    }\n","    90% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","    }\n","  }\n","</style>\n","\n","  <script>\n","    async function quickchart(key) {\n","      const quickchartButtonEl =\n","        document.querySelector('#' + key + ' button');\n","      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n","      quickchartButtonEl.classList.add('colab-df-spinner');\n","      try {\n","        const charts = await google.colab.kernel.invokeFunction(\n","            'suggestCharts', [key], {});\n","      } catch (error) {\n","        console.error('Error during call to suggestCharts:', error);\n","      }\n","      quickchartButtonEl.classList.remove('colab-df-spinner');\n","      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n","    }\n","    (() => {\n","      let quickchartButtonEl =\n","        document.querySelector('#df-c95a7118-7bcb-40ea-bf37-2ed0a2d868fa button');\n","      quickchartButtonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","    })();\n","  </script>\n","</div>\n","    </div>\n","  </div>\n"],"text/plain":["       total_bedrooms  total_rooms\n","17               33.0         44.0\n","19               24.0         97.0\n","113              18.0         96.0\n","116              49.0        208.0\n","120              43.0        186.0\n","...               ...          ...\n","16643            73.0        255.0\n","16733           114.0        411.0\n","16743            18.0         89.0\n","16801            28.0         98.0\n","16851            35.0        133.0\n","\n","[178 rows x 2 columns]"]},"execution_count":32,"metadata":{},"output_type":"execute_result"}],"source":["df.loc[df[\"population\"] < 100, [\"total_bedrooms\", \"total_rooms\"]]"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":385,"status":"ok","timestamp":1708934252809,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"m3IYRG4rUb5p","outputId":"d9c7d195-9bf1-4560-a82f-5496257fc796"},"outputs":[{"name":"stdout","output_type":"stream","text":["A    2\n","B    7\n","Name: b, dtype: int64\n","a    1\n","b    2\n","c    3\n","d    4\n","e    5\n","Name: A, dtype: int64\n","8\n","b    2\n","c    3\n","d    4\n","Name: A, dtype: int64\n","   A   B\n","c  3   8\n","d  4   9\n","e  5  10\n","   A    B\n","a  1    6\n","b  2    7\n","c  3  100\n","d  4    9\n","e  5   10\n"]}],"source":["# Создание DataFrame\n","\n","data = {\"A\": [1, 2, 3, 4, 5], \"B\": [6, 7, 8, 9, 10]}\n","df = pd.DataFrame(data, index=[\"a\", \"b\", \"c\", \"d\", \"e\"])\n","\n","# Выбор строки по метке\n","print(df.loc[\"b\"])\n","\n","# Выбор столбца по метке\n","print(df.loc[:, \"A\"])\n","\n","# Выбор определенной ячейки\n","print(df.loc[\"c\", \"B\"])\n","\n","# Использование среза\n","print(df.loc[\"b\":\"d\", \"A\"])\n","\n","# Выбор по условию\n","print(df.loc[df[\"A\"] > 2])\n","\n","# Изменение значения\n","df.loc[\"c\", \"B\"] = 100\n","print(df)"]},{"cell_type":"markdown","metadata":{"id":"fd3rO2MMilkZ"},"source":["![image.png]()"]},{"cell_type":"markdown","metadata":{"id":"YbvxdCMohBOp"},"source":["# Самостоятельная практика №2\n","\n","\n","*   Показать **median_house_value** где **median_income < 2**\n","*   (Доп) Показать данные в первых 2 столбцах\n","*   (Доп) Выбрать данные где **housing_median_age** < 20 и **median_house_value** > 70000"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"boPXTXxuhINk"},"outputs":[],"source":[]},{"cell_type":"code","execution_count":null,"metadata":{"id":"IWlTjS4cg3pU"},"outputs":[],"source":[]},{"cell_type":"code","execution_count":null,"metadata":{"id":"xuw6X3-pg3jW"},"outputs":[],"source":[]},{"cell_type":"markdown","metadata":{"id":"jQSCn1QthVYa"},"source":["# Простая статистика"]},{"cell_type":"markdown","metadata":{"id":"wJ6aGcQfhy4Z"},"source":["**Pandas** позволяет получить основные простые данные для описательной статистики\n","\n","Такие как минимальное значение в столбце, максимальное значение, сумма всех значений, среднее значение"]},{"cell_type":"markdown","metadata":{"id":"iyjhBEHFkW5D"},"source":["![image.png]()"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":258,"status":"ok","timestamp":1699873843044,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"j3e_ovOPgv1m","outputId":"acdfa7ba-e129-4980-ff5a-52b9dc4b49d3"},"outputs":[{"name":"stdout","output_type":"stream","text":["35682.0\n","3.0\n","1429.5739411764705\n","24302757.0\n"]}],"source":["# Максимальное значение\n","print(df[\"population\"].max())\n","# Минимальное значение\n","print(df[\"population\"].min())\n","# Среднее значение\n","print(df[\"population\"].mean())\n","# Сумма\n","print(df[\"population\"].sum())"]},{"cell_type":"markdown","metadata":{"id":"4eARzcdbkdPR"},"source":["Эту же статистику можно рассчитывать сразу для нескольких столбцов"]},{"cell_type":"markdown","metadata":{"id":"o42qKCrbknbJ"},"source":["![image.png]()"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":258,"status":"ok","timestamp":1692874094867,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"OVFt37rHkLNX","outputId":"8c6dafab-c3a3-4136-ad27-49e5444cd402"},"outputs":[{"data":{"text/plain":["population     1167.0\n","total_rooms    2127.0\n","dtype: float64"]},"execution_count":11,"metadata":{},"output_type":"execute_result"}],"source":["# Медианное значение\n","df[[\"population\", \"total_rooms\"]].median()"]},{"cell_type":"markdown","metadata":{"id":"nNVPXzA5k2iQ"},"source":["Получить общую картину можно простой командой **describe**"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":300},"executionInfo":{"elapsed":272,"status":"ok","timestamp":1699899147473,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"gdpMI8tsklef","outputId":"d4973048-9cdb-4119-f782-9aaf909d9aa9"},"outputs":[{"data":{"text/html":["\n","  <div id=\"df-ecef8514-0a94-422c-a734-de9f3ba40873\" class=\"colab-df-container\">\n","    <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>longitude</th>\n","      <th>latitude</th>\n","      <th>housing_median_age</th>\n","      <th>total_rooms</th>\n","      <th>total_bedrooms</th>\n","      <th>population</th>\n","      <th>households</th>\n","      <th>median_income</th>\n","      <th>median_house_value</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>count</th>\n","      <td>17000.000000</td>\n","      <td>17000.000000</td>\n","      <td>17000.000000</td>\n","      <td>17000.000000</td>\n","      <td>17000.000000</td>\n","      <td>17000.000000</td>\n","      <td>17000.000000</td>\n","      <td>17000.000000</td>\n","      <td>17000.000000</td>\n","    </tr>\n","    <tr>\n","      <th>mean</th>\n","      <td>-119.562108</td>\n","      <td>35.625225</td>\n","      <td>28.589353</td>\n","      <td>2643.664412</td>\n","      <td>539.410824</td>\n","      <td>1429.573941</td>\n","      <td>501.221941</td>\n","      <td>3.883578</td>\n","      <td>207300.912353</td>\n","    </tr>\n","    <tr>\n","      <th>std</th>\n","      <td>2.005166</td>\n","      <td>2.137340</td>\n","      <td>12.586937</td>\n","      <td>2179.947071</td>\n","      <td>421.499452</td>\n","      <td>1147.852959</td>\n","      <td>384.520841</td>\n","      <td>1.908157</td>\n","      <td>115983.764387</td>\n","    </tr>\n","    <tr>\n","      <th>min</th>\n","      <td>-124.350000</td>\n","      <td>32.540000</td>\n","      <td>1.000000</td>\n","      <td>2.000000</td>\n","      <td>1.000000</td>\n","      <td>3.000000</td>\n","      <td>1.000000</td>\n","      <td>0.499900</td>\n","      <td>14999.000000</td>\n","    </tr>\n","    <tr>\n","      <th>25%</th>\n","      <td>-121.790000</td>\n","      <td>33.930000</td>\n","      <td>18.000000</td>\n","      <td>1462.000000</td>\n","      <td>297.000000</td>\n","      <td>790.000000</td>\n","      <td>282.000000</td>\n","      <td>2.566375</td>\n","      <td>119400.000000</td>\n","    </tr>\n","    <tr>\n","      <th>50%</th>\n","      <td>-118.490000</td>\n","      <td>34.250000</td>\n","      <td>29.000000</td>\n","      <td>2127.000000</td>\n","      <td>434.000000</td>\n","      <td>1167.000000</td>\n","      <td>409.000000</td>\n","      <td>3.544600</td>\n","      <td>180400.000000</td>\n","    </tr>\n","    <tr>\n","      <th>75%</th>\n","      <td>-118.000000</td>\n","      <td>37.720000</td>\n","      <td>37.000000</td>\n","      <td>3151.250000</td>\n","      <td>648.250000</td>\n","      <td>1721.000000</td>\n","      <td>605.250000</td>\n","      <td>4.767000</td>\n","      <td>265000.000000</td>\n","    </tr>\n","    <tr>\n","      <th>max</th>\n","      <td>-114.310000</td>\n","      <td>41.950000</td>\n","      <td>52.000000</td>\n","      <td>37937.000000</td>\n","      <td>6445.000000</td>\n","      <td>35682.000000</td>\n","      <td>6082.000000</td>\n","      <td>15.000100</td>\n","      <td>500001.000000</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","    <div class=\"colab-df-buttons\">\n","\n","  <div class=\"colab-df-container\">\n","    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-ecef8514-0a94-422c-a734-de9f3ba40873')\"\n","            title=\"Convert this dataframe to an interactive table.\"\n","            style=\"display:none;\">\n","\n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n","    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n","  </svg>\n","    </button>\n","\n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    .colab-df-buttons div {\n","      margin-bottom: 4px;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","    <script>\n","      const buttonEl =\n","        document.querySelector('#df-ecef8514-0a94-422c-a734-de9f3ba40873 button.colab-df-convert');\n","      buttonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","      async function convertToInteractive(key) {\n","        const element = document.querySelector('#df-ecef8514-0a94-422c-a734-de9f3ba40873');\n","        const dataTable =\n","          await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                    [key], {});\n","        if (!dataTable) return;\n","\n","        const docLinkHtml = 'Like what you see? Visit the ' +\n","          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","          + ' to learn more about interactive tables.';\n","        element.innerHTML = '';\n","        dataTable['output_type'] = 'display_data';\n","        await google.colab.output.renderOutput(dataTable, element);\n","        const docLink = document.createElement('div');\n","        docLink.innerHTML = docLinkHtml;\n","        element.appendChild(docLink);\n","      }\n","    </script>\n","  </div>\n","\n","\n","<div id=\"df-a87f068a-f690-4e55-9db8-cf5ab2433b35\">\n","  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-a87f068a-f690-4e55-9db8-cf5ab2433b35')\"\n","            title=\"Suggest charts\"\n","            style=\"display:none;\">\n","\n","<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","     width=\"24px\">\n","    <g>\n","        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n","    </g>\n","</svg>\n","  </button>\n","\n","<style>\n","  .colab-df-quickchart {\n","      --bg-color: #E8F0FE;\n","      --fill-color: #1967D2;\n","      --hover-bg-color: #E2EBFA;\n","      --hover-fill-color: #174EA6;\n","      --disabled-fill-color: #AAA;\n","      --disabled-bg-color: #DDD;\n","  }\n","\n","  [theme=dark] .colab-df-quickchart {\n","      --bg-color: #3B4455;\n","      --fill-color: #D2E3FC;\n","      --hover-bg-color: #434B5C;\n","      --hover-fill-color: #FFFFFF;\n","      --disabled-bg-color: #3B4455;\n","      --disabled-fill-color: #666;\n","  }\n","\n","  .colab-df-quickchart {\n","    background-color: var(--bg-color);\n","    border: none;\n","    border-radius: 50%;\n","    cursor: pointer;\n","    display: none;\n","    fill: var(--fill-color);\n","    height: 32px;\n","    padding: 0;\n","    width: 32px;\n","  }\n","\n","  .colab-df-quickchart:hover {\n","    background-color: var(--hover-bg-color);\n","    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n","    fill: var(--button-hover-fill-color);\n","  }\n","\n","  .colab-df-quickchart-complete:disabled,\n","  .colab-df-quickchart-complete:disabled:hover {\n","    background-color: var(--disabled-bg-color);\n","    fill: var(--disabled-fill-color);\n","    box-shadow: none;\n","  }\n","\n","  .colab-df-spinner {\n","    border: 2px solid var(--fill-color);\n","    border-color: transparent;\n","    border-bottom-color: var(--fill-color);\n","    animation:\n","      spin 1s steps(1) infinite;\n","  }\n","\n","  @keyframes spin {\n","    0% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","      border-left-color: var(--fill-color);\n","    }\n","    20% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    30% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","      border-right-color: var(--fill-color);\n","    }\n","    40% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    60% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","    }\n","    80% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-bottom-color: var(--fill-color);\n","    }\n","    90% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","    }\n","  }\n","</style>\n","\n","  <script>\n","    async function quickchart(key) {\n","      const quickchartButtonEl =\n","        document.querySelector('#' + key + ' button');\n","      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n","      quickchartButtonEl.classList.add('colab-df-spinner');\n","      try {\n","        const charts = await google.colab.kernel.invokeFunction(\n","            'suggestCharts', [key], {});\n","      } catch (error) {\n","        console.error('Error during call to suggestCharts:', error);\n","      }\n","      quickchartButtonEl.classList.remove('colab-df-spinner');\n","      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n","    }\n","    (() => {\n","      let quickchartButtonEl =\n","        document.querySelector('#df-a87f068a-f690-4e55-9db8-cf5ab2433b35 button');\n","      quickchartButtonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","    })();\n","  </script>\n","</div>\n","    </div>\n","  </div>\n"],"text/plain":["          longitude      latitude  housing_median_age   total_rooms  \\\n","count  17000.000000  17000.000000        17000.000000  17000.000000   \n","mean    -119.562108     35.625225           28.589353   2643.664412   \n","std        2.005166      2.137340           12.586937   2179.947071   \n","min     -124.350000     32.540000            1.000000      2.000000   \n","25%     -121.790000     33.930000           18.000000   1462.000000   \n","50%     -118.490000     34.250000           29.000000   2127.000000   \n","75%     -118.000000     37.720000           37.000000   3151.250000   \n","max     -114.310000     41.950000           52.000000  37937.000000   \n","\n","       total_bedrooms    population    households  median_income  \\\n","count    17000.000000  17000.000000  17000.000000   17000.000000   \n","mean       539.410824   1429.573941    501.221941       3.883578   \n","std        421.499452   1147.852959    384.520841       1.908157   \n","min          1.000000      3.000000      1.000000       0.499900   \n","25%        297.000000    790.000000    282.000000       2.566375   \n","50%        434.000000   1167.000000    409.000000       3.544600   \n","75%        648.250000   1721.000000    605.250000       4.767000   \n","max       6445.000000  35682.000000   6082.000000      15.000100   \n","\n","       median_house_value  \n","count        17000.000000  \n","mean        207300.912353  \n","std         115983.764387  \n","min          14999.000000  \n","25%         119400.000000  \n","50%         180400.000000  \n","75%         265000.000000  \n","max         500001.000000  "]},"execution_count":11,"metadata":{},"output_type":"execute_result"}],"source":["df.describe()"]},{"cell_type":"markdown","metadata":{"id":"rNfhq7D3MExI"},"source":[]},{"cell_type":"markdown","metadata":{"id":"QHELVEIBhOP2"},"source":["**count** - Общее кол-во не пустых строк\n","\n","**mean** - среднее значение в столбце\n","\n","**std** -  стандартное отклонение от среднего значения\n","\n","**min** - минимальное значение\n","\n","**max** - максимальное значение\n","\n","Числа **25%, 50%, 75%** - перцентили\n","\n","> **Перцентиль** - это показатель, используемый в статистике, показывающий значение, ниже которого падает определенный процент наблюдений в группе наблюдений\n","\n"]},{"cell_type":"markdown","metadata":{"id":"o6VM2sQQsDmL"},"source":["# Самостоятельная практика №3\n","\n","\n","\n","\n","*   Определить какое максимальное и минимальное значение **median_house_value**\n","* (Доп) Показать максимальное **median_house_value**, где **median_income** = 3.1250\n","*  (Доп) Узнать какая максимальная **population** в зоне минимального значения **median_house_value**\n","\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"VMgbETDuhwBE","outputId":"97003d2f-f421-4083-b295-21ebdbeec2ed"},"outputs":[{"data":{"text/plain":["2001    1230.0\n","Name: population, dtype: float64"]},"execution_count":33,"metadata":{},"output_type":"execute_result"}],"source":[]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":453,"status":"ok","timestamp":1699899210628,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"LU8pZixoZF7k","outputId":"1a4f1695-f0d3-44ea-eb44-706d8670730c"},"outputs":[{"data":{"text/plain":["233000"]},"execution_count":12,"metadata":{},"output_type":"execute_result"}],"source":["233000"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"4Kp46o5c-i0e"},"outputs":[],"source":[]},{"cell_type":"code","execution_count":null,"metadata":{"id":"8QnRisNUhv9s"},"outputs":[],"source":[]},{"cell_type":"code","execution_count":null,"metadata":{"id":"ej7PXxfcWR9q"},"outputs":[],"source":["import seaborn as sns\n","\n","tit = sns.load_dataset(\"titanic\")"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":221},"executionInfo":{"elapsed":511,"status":"ok","timestamp":1696614696803,"user":{"displayName":"1","userId":"05691895137752539062"},"user_tz":-180},"id":"fUTUGyUMHNvX","outputId":"5e868fb6-184c-4e15-9dcd-1419f7040e4c"},"outputs":[{"data":{"text/html":["\n","  <div id=\"df-2788af67-1f61-4978-88de-ed6b1848c855\" class=\"colab-df-container\">\n","    <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>survived</th>\n","      <th>pclass</th>\n","      <th>sex</th>\n","      <th>age</th>\n","      <th>sibsp</th>\n","      <th>parch</th>\n","      <th>fare</th>\n","      <th>embarked</th>\n","      <th>class</th>\n","      <th>who</th>\n","      <th>adult_male</th>\n","      <th>deck</th>\n","      <th>embark_town</th>\n","      <th>alive</th>\n","      <th>alone</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>0</td>\n","      <td>3</td>\n","      <td>male</td>\n","      <td>22.0</td>\n","      <td>1</td>\n","      <td>0</td>\n","      <td>7.2500</td>\n","      <td>S</td>\n","      <td>Third</td>\n","      <td>man</td>\n","      <td>True</td>\n","      <td>NaN</td>\n","      <td>Southampton</td>\n","      <td>no</td>\n","      <td>False</td>\n","    </tr>\n","    <tr>\n","      <th>1</th>\n","      <td>1</td>\n","      <td>1</td>\n","      <td>female</td>\n","      <td>38.0</td>\n","      <td>1</td>\n","      <td>0</td>\n","      <td>71.2833</td>\n","      <td>C</td>\n","      <td>First</td>\n","      <td>woman</td>\n","      <td>False</td>\n","      <td>C</td>\n","      <td>Cherbourg</td>\n","      <td>yes</td>\n","      <td>False</td>\n","    </tr>\n","    <tr>\n","      <th>2</th>\n","      <td>1</td>\n","      <td>3</td>\n","      <td>female</td>\n","      <td>26.0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>7.9250</td>\n","      <td>S</td>\n","      <td>Third</td>\n","      <td>woman</td>\n","      <td>False</td>\n","      <td>NaN</td>\n","      <td>Southampton</td>\n","      <td>yes</td>\n","      <td>True</td>\n","    </tr>\n","    <tr>\n","      <th>3</th>\n","      <td>1</td>\n","      <td>1</td>\n","      <td>female</td>\n","      <td>35.0</td>\n","      <td>1</td>\n","      <td>0</td>\n","      <td>53.1000</td>\n","      <td>S</td>\n","      <td>First</td>\n","      <td>woman</td>\n","      <td>False</td>\n","      <td>C</td>\n","      <td>Southampton</td>\n","      <td>yes</td>\n","      <td>False</td>\n","    </tr>\n","    <tr>\n","      <th>4</th>\n","      <td>0</td>\n","      <td>3</td>\n","      <td>male</td>\n","      <td>35.0</td>\n","      <td>0</td>\n","      <td>0</td>\n","      <td>8.0500</td>\n","      <td>S</td>\n","      <td>Third</td>\n","      <td>man</td>\n","      <td>True</td>\n","      <td>NaN</td>\n","      <td>Southampton</td>\n","      <td>no</td>\n","      <td>True</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","    <div class=\"colab-df-buttons\">\n","\n","  <div class=\"colab-df-container\">\n","    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-2788af67-1f61-4978-88de-ed6b1848c855')\"\n","            title=\"Convert this dataframe to an interactive table.\"\n","            style=\"display:none;\">\n","\n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n","    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n","  </svg>\n","    </button>\n","\n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    .colab-df-buttons div {\n","      margin-bottom: 4px;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","    <script>\n","      const buttonEl =\n","        document.querySelector('#df-2788af67-1f61-4978-88de-ed6b1848c855 button.colab-df-convert');\n","      buttonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","      async function convertToInteractive(key) {\n","        const element = document.querySelector('#df-2788af67-1f61-4978-88de-ed6b1848c855');\n","        const dataTable =\n","          await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                    [key], {});\n","        if (!dataTable) return;\n","\n","        const docLinkHtml = 'Like what you see? Visit the ' +\n","          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","          + ' to learn more about interactive tables.';\n","        element.innerHTML = '';\n","        dataTable['output_type'] = 'display_data';\n","        await google.colab.output.renderOutput(dataTable, element);\n","        const docLink = document.createElement('div');\n","        docLink.innerHTML = docLinkHtml;\n","        element.appendChild(docLink);\n","      }\n","    </script>\n","  </div>\n","\n","\n","<div id=\"df-01587d76-8346-4072-8899-4b21bf2d75ab\">\n","  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-01587d76-8346-4072-8899-4b21bf2d75ab')\"\n","            title=\"Suggest charts.\"\n","            style=\"display:none;\">\n","\n","<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","     width=\"24px\">\n","    <g>\n","        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n","    </g>\n","</svg>\n","  </button>\n","\n","<style>\n","  .colab-df-quickchart {\n","      --bg-color: #E8F0FE;\n","      --fill-color: #1967D2;\n","      --hover-bg-color: #E2EBFA;\n","      --hover-fill-color: #174EA6;\n","      --disabled-fill-color: #AAA;\n","      --disabled-bg-color: #DDD;\n","  }\n","\n","  [theme=dark] .colab-df-quickchart {\n","      --bg-color: #3B4455;\n","      --fill-color: #D2E3FC;\n","      --hover-bg-color: #434B5C;\n","      --hover-fill-color: #FFFFFF;\n","      --disabled-bg-color: #3B4455;\n","      --disabled-fill-color: #666;\n","  }\n","\n","  .colab-df-quickchart {\n","    background-color: var(--bg-color);\n","    border: none;\n","    border-radius: 50%;\n","    cursor: pointer;\n","    display: none;\n","    fill: var(--fill-color);\n","    height: 32px;\n","    padding: 0;\n","    width: 32px;\n","  }\n","\n","  .colab-df-quickchart:hover {\n","    background-color: var(--hover-bg-color);\n","    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n","    fill: var(--button-hover-fill-color);\n","  }\n","\n","  .colab-df-quickchart-complete:disabled,\n","  .colab-df-quickchart-complete:disabled:hover {\n","    background-color: var(--disabled-bg-color);\n","    fill: var(--disabled-fill-color);\n","    box-shadow: none;\n","  }\n","\n","  .colab-df-spinner {\n","    border: 2px solid var(--fill-color);\n","    border-color: transparent;\n","    border-bottom-color: var(--fill-color);\n","    animation:\n","      spin 1s steps(1) infinite;\n","  }\n","\n","  @keyframes spin {\n","    0% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","      border-left-color: var(--fill-color);\n","    }\n","    20% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    30% {\n","      border-color: transparent;\n","      border-left-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","      border-right-color: var(--fill-color);\n","    }\n","    40% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-top-color: var(--fill-color);\n","    }\n","    60% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","    }\n","    80% {\n","      border-color: transparent;\n","      border-right-color: var(--fill-color);\n","      border-bottom-color: var(--fill-color);\n","    }\n","    90% {\n","      border-color: transparent;\n","      border-bottom-color: var(--fill-color);\n","    }\n","  }\n","</style>\n","\n","  <script>\n","    async function quickchart(key) {\n","      const quickchartButtonEl =\n","        document.querySelector('#' + key + ' button');\n","      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n","      quickchartButtonEl.classList.add('colab-df-spinner');\n","      try {\n","        const charts = await google.colab.kernel.invokeFunction(\n","            'suggestCharts', [key], {});\n","      } catch (error) {\n","        console.error('Error during call to suggestCharts:', error);\n","      }\n","      quickchartButtonEl.classList.remove('colab-df-spinner');\n","      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n","    }\n","    (() => {\n","      let quickchartButtonEl =\n","        document.querySelector('#df-01587d76-8346-4072-8899-4b21bf2d75ab button');\n","      quickchartButtonEl.style.display =\n","        google.colab.kernel.accessAllowed ? 'block' : 'none';\n","    })();\n","  </script>\n","</div>\n","    </div>\n","  </div>\n"],"text/plain":["   survived  pclass     sex   age  sibsp  parch     fare embarked  class  \\\n","0         0       3    male  22.0      1      0   7.2500        S  Third   \n","1         1       1  female  38.0      1      0  71.2833        C  First   \n","2         1       3  female  26.0      0      0   7.9250        S  Third   \n","3         1       1  female  35.0      1      0  53.1000        S  First   \n","4         0       3    male  35.0      0      0   8.0500        S  Third   \n","\n","     who  adult_male deck  embark_town alive  alone  \n","0    man        True  NaN  Southampton    no  False  \n","1  woman       False    C    Cherbourg   yes  False  \n","2  woman       False  NaN  Southampton   yes   True  \n","3  woman       False    C  Southampton   yes  False  \n","4    man        True  NaN  Southampton    no   True  "]},"execution_count":8,"metadata":{},"output_type":"execute_result"}],"source":["tit.head()"]},{"cell_type":"markdown","metadata":{"id":"dye2hvvbNF9C"},"source":["## Kahoot\n","\n","https://kahoot.it/\n","\n","Преподаватель отправит вам ссылку на игру в чат"]}],"metadata":{"colab":{"provenance":[{"file_id":"11udiVDM85HFjqLqDqfz0ef9NLBgHUWn-","timestamp":1709191542766}]},"kernelspec":{"display_name":"Python 3","name":"python3"},"language_info":{"name":"python"}},"nbformat":4,"nbformat_minor":0}
